/* ==========================================================
   Berkay Özışık — personal site
   One stylesheet for every page.
   ========================================================== */

:root {
    --paper:   #f7f5f0;
    --card:    #fbfaf6;
    --ink:     #1c1b19;
    --soft:    #4a463f;
    --muted:   #7a746a;
    --rule:    #ddd7cb;
    --tint:    #efebe2;
    --link:    #284b8c;
    --warm:    #b0502c;

    --serif: "Iowan Old Style", "Charter", "Bitstream Charter", "Palatino Linotype", Palatino, Georgia, serif;
    --mono:  ui-monospace, "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;

    --width: 52rem;
    --text:  42rem;
}

@media (prefers-color-scheme: dark) {
    :root {
        --paper: #191816;
        --card:  #1f1e1b;
        --ink:   #ebe7df;
        --soft:  #c9c3b8;
        --muted: #948d81;
        --rule:  #36332e;
        --tint:  #25231f;
        --link:  #8fb0ec;
        --warm:  #e08a63;
    }
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    overflow-x: clip;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--serif);
    font-size: 1.125rem;
    line-height: 1.6;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: var(--link);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
    text-decoration-color: color-mix(in srgb, var(--link) 35%, transparent);
    transition: color 0.2s, text-decoration-color 0.2s;
}

a:hover {
    text-decoration-color: currentColor;
}

::selection {
    background: color-mix(in srgb, var(--warm) 25%, transparent);
}

/* ---------- Page frame ---------- */

.wrap {
    max-width: var(--width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.wrap.narrow {
    max-width: calc(var(--text) + 3rem);
}

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem 2rem;
    padding: 2rem 0 1rem;
}

.site-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--ink);
    text-decoration: none;
}

.site-nav {
    margin-left: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.4rem;
    font-size: 0.95rem;
}

.site-nav a {
    position: relative;
    color: var(--soft);
    text-decoration: none;
}

.site-nav a::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -2px;
    height: 1px;
    background: var(--warm);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.25s ease;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
    color: var(--ink);
}

.site-nav a:hover::after,
.site-nav a[aria-current="page"]::after {
    transform: scaleX(1);
}

.site-footer {
    margin-top: 5rem;
    padding: 1.5rem 0 3rem;
    border-top: 1px solid var(--rule);
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem 2rem;
    font-size: 0.9rem;
    color: var(--muted);
}

/* Small uppercase label used in several places */
.kicker {
    font-family: var(--mono);
    font-size: 0.75rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--warm);
}

/* ---------- Hero ---------- */

.hero {
    display: grid;
    grid-template-columns: 1fr 15rem;
    gap: 3.5rem;
    align-items: center;
    padding: 3.5rem 0 4.5rem;
}

.hero .kicker {
    margin: 0 0 1rem;
}

.hero h1 {
    margin: 0 0 1.25rem;
    font-size: 3.4rem;
    line-height: 1.05;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.hero h1 em {
    font-weight: 400;
    color: var(--warm);
}

.hero .summary strong {
    font-weight: 600;
    color: var(--ink);
}

.hero .summary {
    margin: 0 0 1.75rem;
    max-width: 34rem;
    font-size: 1.2rem;
    line-height: 1.55;
    color: var(--soft);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--ink);
    border-radius: 2px;
    color: var(--ink);
    font-size: 0.95rem;
    text-decoration: none;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.btn:hover {
    background: var(--ink);
    color: var(--paper);
}

.btn.primary {
    background: var(--ink);
    color: var(--paper);
}

.btn.primary:hover {
    background: var(--warm);
    border-color: var(--warm);
}

.btn .arrow {
    transition: transform 0.2s;
}

.btn:hover .arrow {
    transform: translateY(2px);
}

/* Photo with an offset frame and phase-plane orbits behind it */
.portrait {
    justify-self: end;
    width: 15rem;
    margin: 0;
}

.frame {
    position: relative;
}

.frame::before {
    content: "";
    position: absolute;
    width: 20rem;
    height: 20rem;
    left: -4.5rem;
    bottom: -7rem;
    background: url("../images/orbits.svg") center / contain no-repeat;
    opacity: 0.45;
    z-index: 0;
    pointer-events: none;
}

.frame::after {
    content: "";
    position: absolute;
    inset: 0.9rem -0.9rem -0.9rem 0.9rem;
    border: 1px solid var(--warm);
    z-index: 1;
}

.frame img {
    position: relative;
    z-index: 2;
    width: 100%;
    aspect-ratio: 7 / 9;
    object-fit: cover;
    filter: saturate(0.9) contrast(1.02);
}

.portrait figcaption {
    position: relative;
    z-index: 2;
    margin-top: 1.6rem;
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    color: var(--muted);
    width: fit-content;
    margin-left: auto;
    padding: 0.1rem 0 0.1rem 0.5rem;
    background: var(--paper);
    white-space: nowrap;
}

/* ---------- Sections ---------- */

.section {
    padding: 2.5rem 0 1rem;
    scroll-margin-top: 1rem;
}

.section-head {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.section-head h2 {
    margin: 0;
    font-size: 1.7rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.section-head::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--rule);
    transform: translateY(-0.35rem);
}

/* ---------- Timeline (experience, education) ---------- */

.timeline {
    list-style: none;
    margin: 0;
    padding: 0 0 0 1.75rem;
    border-left: 1px solid var(--rule);
}

.timeline > li {
    position: relative;
    padding-bottom: 2.25rem;
}

.timeline > li:last-child {
    padding-bottom: 0.25rem;
}

.timeline > li::before {
    content: "";
    position: absolute;
    left: calc(-1.75rem - 5px);
    top: 0.35rem;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--paper);
    border: 2px solid var(--warm);
}

.timeline > li.current::before {
    background: var(--warm);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--warm) 18%, transparent);
}

.when {
    display: block;
    font-family: var(--mono);
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    color: var(--muted);
    margin-bottom: 0.25rem;
}

.role {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.35;
}

.org {
    margin: 0.1rem 0 0.6rem;
    color: var(--soft);
    font-style: italic;
}

.points {
    margin: 0;
    padding-left: 1.1rem;
    color: var(--soft);
}

.points li {
    margin: 0.3rem 0;
}

.points li::marker {
    color: var(--warm);
}

.desc {
    margin: 0.35rem 0 0;
    max-width: 38rem;
    color: var(--soft);
}

.tools {
    margin: 0.6rem 0 0;
    font-family: var(--mono);
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--warm);
}

/* ---------- Publications ---------- */

.pub {
    display: grid;
    grid-template-columns: 4.5rem 1fr;
    gap: 1.25rem;
}

.pub .year {
    font-family: var(--mono);
    font-size: 0.85rem;
    color: var(--muted);
    padding-top: 0.2rem;
}

.pub .title {
    margin: 0 0 0.3rem;
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.35;
}

.pub .authors {
    margin: 0;
    color: var(--soft);
}

.pub .authors b {
    color: var(--ink);
    font-weight: 600;
}

.pub .venue {
    margin: 0;
    color: var(--muted);
    font-style: italic;
}

.pub .abstract {
    margin: 0.6rem 0 0;
    max-width: 38rem;
    font-size: 1rem;
    color: var(--soft);
}

.pub-links {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.chip-link {
    padding: 0.15rem 0.6rem;
    border: 1px solid var(--rule);
    border-radius: 2px;
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--ink);
    text-decoration: none;
}

.chip-link:hover {
    border-color: var(--warm);
    color: var(--warm);
}

/* ---------- Writing list (home + writing index) ---------- */

.post-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--rule);
}

.post-list li {
    display: grid;
    grid-template-columns: 7rem 1fr auto;
    gap: 1rem;
    align-items: baseline;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--rule);
}

.post-list time {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--muted);
}

.post-list a {
    color: var(--ink);
    text-decoration: none;
}

.post-list a:hover {
    color: var(--warm);
}

.tag {
    font-size: 0.85rem;
    font-style: italic;
    color: var(--warm);
}

.more {
    margin-top: 1rem;
    font-size: 0.95rem;
}

/* ---------- Contact ---------- */

.contact {
    max-width: 30rem;
}

.contact .lead {
    margin: 0;
    font-size: 1.35rem;
    line-height: 1.45;
}

.contact .lead a {
    color: var(--warm);
}

.contact-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.contact-list li {
    display: grid;
    grid-template-columns: 6.5rem 1fr;
    gap: 1rem;
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--rule);
}

.contact-list li:first-child {
    border-top: 1px solid var(--rule);
}

.contact-list .label {
    font-family: var(--mono);
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    padding-top: 0.2rem;
}

/* ---------- Writing index page ---------- */

.page-head {
    padding: 3rem 0 2rem;
}

.page-head .kicker {
    margin: 0 0 0.75rem;
    color: var(--warm);
}

.page-head h1 {
    margin: 0 0 0.5rem;
    font-size: 2.8rem;
    line-height: 1.1;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.page-head p {
    margin: 0;
    color: var(--soft);
}

.year-label {
    margin: 2rem 0 0.5rem;
    font-family: var(--mono);
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--muted);
}

/* ---------- Article ---------- */

.post {
    padding: 3rem 0 0;
}

.post-header {
    margin-bottom: 2.5rem;
    padding-bottom: 1.75rem;
    border-bottom: 1px solid var(--rule);
}

.post-header .kicker {
    margin: 0 0 0.75rem;
}

.post-header h1 {
    margin: 0 0 0.75rem;
    font-size: 2.5rem;
    line-height: 1.15;
    font-weight: 600;
    letter-spacing: -0.015em;
}

.post-meta {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.post-body h2 {
    margin: 2.5rem 0 0.75rem;
    font-size: 1.35rem;
    font-weight: 600;
}

.post-body p {
    margin: 0 0 1.2rem;
}

.post-body code {
    font-family: var(--mono);
    font-size: 0.88em;
    background: var(--tint);
    padding: 0.08em 0.3em;
    border-radius: 3px;
}

.post-body pre {
    margin: 1.5rem 0;
    padding: 1.1rem 1.25rem;
    background: var(--tint);
    border-left: 3px solid var(--warm);
    overflow-x: auto;
    font-size: 0.9rem;
    line-height: 1.55;
}

.post-body pre code {
    background: none;
    padding: 0;
    font-size: inherit;
}

.equation {
    margin: 1.5rem 0;
    overflow-x: auto;
    overflow-y: hidden;
}

.post-end {
    margin-top: 3rem;
    font-size: 0.95rem;
}

/* ---------- Gentle entrance ---------- */

@media (prefers-reduced-motion: no-preference) {
    .hero > *,
    .section {
        animation: rise 0.7s ease both;
    }

    .hero .portrait { animation-delay: 0.12s; }
    .section:nth-of-type(2) { animation-delay: 0.15s; }
    .section:nth-of-type(3) { animation-delay: 0.22s; }

    @keyframes rise {
        from { opacity: 0; transform: translateY(10px); }
        to   { opacity: 1; transform: none; }
    }
}

/* ---------- Small screens ---------- */

@media (max-width: 760px) {
    body {
        font-size: 1.0625rem;
    }

    .hero {
        grid-template-columns: 1fr;
        gap: 2.5rem;
        padding: 2rem 0 3rem;
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    .hero .summary strong {
    font-weight: 600;
    color: var(--ink);
}

.hero .summary {
        font-size: 1.1rem;
    }

    .portrait {
        justify-self: start;
        width: 11rem;
        order: -1;
        margin-left: 0.5rem;
    }

    .frame::before {
        left: auto;
        right: -8rem;
        bottom: -3.5rem;
        width: 15rem;
        height: 15rem;
    }

    .portrait figcaption {
        margin-left: 0;
        padding: 0.1rem 0.5rem 0.1rem 0;
    }

    .cards,
    .contact {
        grid-template-columns: 1fr;
    }

    .contact {
        gap: 1.5rem;
    }


    .pub {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }

    .post-list li {
        grid-template-columns: 1fr;
        gap: 0.1rem;
    }

    .page-head h1,
    .post-header h1 {
        font-size: 2rem;
    }
}
