/* ──────────────────────────────────────────────────────────────
   Portfolio design tokens
   Paper / Ink / Graphite / Mist / Hairline, one Swift-orange accent.
   ────────────────────────────────────────────────────────────── */
/* Geist is self-hosted (SIL Open Font License, see /fonts) so text renders without a third-party request. */
@font-face { font-family: "Geist"; src: url("/fonts/Geist-Variable.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("/fonts/GeistMono-Variable.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }

:root {
    --paper: #FCFCFD;
    --ink: #15171C;
    --graphite: #4A5060;
    --mist: #6B7080;
    --hairline: #E7E8EC;
    --wash: #F4F5F7;
    --swift: #F05138;

    --sans: "Geist", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
    --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

    --measure: 720px;

    --bs-body-bg: var(--paper);
    --bs-body-color: var(--ink);
    --bs-body-font-family: var(--sans);
    --bs-link-color-rgb: 21, 23, 28;
    --bs-link-hover-color-rgb: 240, 81, 56;
    --bs-border-color: var(--hairline);
}

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

body.container {
    max-width: none;
    padding: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 17px;
    line-height: 1.65;
    font-feature-settings: "ss01", "cv11";
    -webkit-font-smoothing: antialiased;
}

/* One centered reading column for everything */
.ig-main-content {
    max-width: var(--measure);
    margin: 0 auto;
    padding: 0 24px !important;
}

/* ── Type scale ───────────────────────────────────────────── */
h1, h2, h3, h4, h5 { font-family: var(--sans); color: var(--ink); letter-spacing: -0.02em; }
h1 { font-size: clamp(2.1rem, 4.6vw, 2.75rem); font-weight: 600; line-height: 1.1; letter-spacing: -0.03em; }
h2 { font-size: 1.5rem; font-weight: 600; line-height: 1.25; margin-top: 2.75rem; margin-bottom: 0.75rem; }
h3 { font-size: 1.15rem; font-weight: 600; line-height: 1.35; margin-top: 2rem; margin-bottom: 0.5rem; letter-spacing: -0.01em; }
p, li { color: var(--ink); }
p { margin-bottom: 1.1rem; }
strong, b { font-weight: 600; }
.lead { font-size: 1.2rem; line-height: 1.55; font-weight: 400; color: var(--graphite); }
.text-body-secondary, .meta { color: var(--mist) !important; }
.ig-text-small, .small { font-size: 0.875rem; }

a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--hairline); text-underline-offset: 3px; text-decoration-thickness: 1.5px; transition: color .15s, text-decoration-color .15s; }
a:hover { color: var(--swift); text-decoration-color: currentColor; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--swift); outline-offset: 3px; border-radius: 4px; }

/* ── Navigation ───────────────────────────────────────────── */
.site-nav {
    max-width: var(--measure);
    margin: 0 auto;
    padding: 28px 24px 0;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.site-nav p { margin: 0; }
.site-nav .brand { font-weight: 600; letter-spacing: -0.01em; text-decoration: none; }
.site-nav .links { display: flex; gap: 22px; font-size: 0.95rem; }
.site-nav .links a { color: var(--graphite); text-decoration: none; }
.site-nav .links a:hover { color: var(--ink); }

/* ── Hero: the one loud thing ─────────────────────────────── */
.hero { padding: 96px 0 56px; }
.hero h1 {
    font-size: clamp(2.6rem, 7.2vw, 4.4rem);
    font-weight: 600;
    line-height: 1.02;
    letter-spacing: -0.045em;
    margin-bottom: 1.5rem;
    max-width: none;
}
.hero h1::after {
    content: "";
    display: inline-block;
    width: 0.09em;
    height: 0.82em;
    margin-left: 0.08em;
    background: var(--swift);
    vertical-align: -0.06em;
    animation: caret 1.1s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .hero h1::after { animation: none; } }
.hero .lead { max-width: 36em; margin-bottom: 2rem; }
.hero .actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* Buttons: solid ink and a quiet outline */
.btn { font-family: var(--sans); font-weight: 500; font-size: 0.95rem; border-radius: 8px; padding: 0.6rem 1.05rem; text-decoration: none; box-shadow: none !important; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover, .btn-primary:focus { background: #2A2E37; border-color: #2A2E37; color: #fff; }
.btn-secondary { background: transparent; border: 1.5px solid var(--hairline); color: var(--ink); }
.btn-secondary:hover, .btn-secondary:focus { background: var(--wash); border-color: var(--hairline); color: var(--ink); }

/* ── Section headings on index pages ──────────────────────── */
.section-title { font-size: 1rem; font-weight: 500; color: var(--graphite); letter-spacing: 0; margin: 0 0 4px; }
.page-head { padding: 72px 0 24px; }
.page-head h1 { margin-bottom: 0.75rem; }

/* ── Index rows (projects + writing) ──────────────────────── */
.row-list { border-top: 1px solid var(--hairline); margin-bottom: 3.5rem; }
.entry {
    display: grid;
    grid-template-columns: 1fr auto;
    column-gap: 24px;
    padding: 22px 0;
    border-bottom: 1px solid var(--hairline);
}
.entry p { margin: 0; }
.entry .entry-title { font-size: 1.12rem; font-weight: 600; letter-spacing: -0.015em; text-decoration: none; }
.entry .entry-title:hover { color: var(--swift); }
.entry .entry-side { grid-column: 2; grid-row: 1; color: var(--mist); font-size: 0.875rem; font-variant-numeric: tabular-nums; white-space: nowrap; padding-top: 3px; }
.entry .entry-summary { grid-column: 1 / -1; color: var(--graphite); margin-top: 4px; max-width: 40em; }
.entry .entry-meta { grid-column: 1 / -1; color: var(--mist); font-size: 0.875rem; margin-top: 8px; }
.more-link { font-size: 0.95rem; color: var(--graphite); }

/* ── Long-form (articles + case studies) ──────────────────── */
.article-head { padding: 64px 0 8px; }
.article-head .back { font-size: 0.9rem; color: var(--mist); text-decoration: none; }
.article-head .back:hover { color: var(--ink); }
.article-head h1 { margin: 1.25rem 0 0.75rem; }
.article-head .lead { margin-bottom: 1rem; }
.article-head .meta { font-size: 0.9rem; }
.article-head .btn { margin-top: 0.75rem; }
.prose { padding-bottom: 3rem; }
.prose > h2:first-child { margin-top: 2rem; }
.prose ul, .prose ol { padding-left: 1.25rem; margin-bottom: 1.25rem; }
.prose li { margin-bottom: 0.4rem; }
.prose li::marker { color: var(--mist); }
.prose hr { border-color: var(--hairline); opacity: 1; margin: 3rem 0; }

/* Code */
code { font-variant-ligatures: none; font-family: var(--mono); font-size: 0.86em; color: var(--ink); background: var(--wash); padding: 0.12em 0.36em; border-radius: 5px; }
pre, pre[class*="language-"] { font-variant-ligatures: none; font-family: var(--mono); font-size: 0.85rem; line-height: 1.6; background: var(--wash) !important; border: 1px solid var(--hairline); border-radius: 10px; padding: 1.1rem 1.25rem !important; margin: 0 0 1.5rem !important; overflow-x: auto; max-width: 100%; }
pre code, pre[class*="language-"] code { background: none; padding: 0; font-size: inherit; }

/* Tables: ruled, not boxed */
.prose table, table { width: 100%; font-size: 0.94rem; margin: 0 0 1.75rem; border-collapse: collapse; display: block; overflow-x: auto; }
table th { font-weight: 600; text-align: left; padding: 0 16px 10px 0; border-bottom: 1.5px solid var(--ink); white-space: nowrap; }
table td { padding: 12px 16px 12px 0; border-bottom: 1px solid var(--hairline); vertical-align: top; color: var(--graphite); }
table td:first-child { color: var(--ink); font-weight: 500; }
.table > :not(caption) > * > * { background: transparent; box-shadow: none; }

/* ── Résumé ───────────────────────────────────────────────── */
.resume-head { padding: 64px 0 8px; display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.resume-head h1 { margin: 0; }
.resume-head .lead { margin: 0.5rem 0 0; }
.resume h2 { font-size: 1.05rem; font-weight: 600; color: var(--ink); border-bottom: 1px solid var(--hairline); padding-bottom: 8px; margin-top: 2.75rem; }
.resume .job { margin-top: 1.4rem; }
.resume .job-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 0; }
.resume .job-head .when { color: var(--mist); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.resume .job-detail { color: var(--graphite); font-size: 0.95rem; margin: 2px 0 8px; }
.resume ul { padding-left: 1.2rem; margin: 0; }
.resume li { margin-bottom: 0.35rem; color: var(--graphite); }
.resume li::marker { color: var(--mist); }
.resume .skills p { margin-bottom: 0.4rem; color: var(--graphite); }
.resume .skills strong { color: var(--ink); }

/* ── Footer ───────────────────────────────────────────────── */
.site-footer { max-width: var(--measure); margin: 0 auto; padding: 32px 24px 56px; border-top: 1px solid var(--hairline); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 0.9rem; color: var(--mist); }
.site-footer p { margin: 0; color: var(--mist); }
.site-footer .links { display: flex; gap: 20px; }
.site-footer a { color: var(--graphite); text-decoration: none; }
.site-footer a:hover { color: var(--ink); }

/* Ignite wraps the header in pb-5; we control spacing ourselves */
body > .pb-5 { padding-bottom: 0 !important; }

@media (max-width: 560px) {
    body.container { font-size: 16px; }
    .hero { padding: 64px 0 40px; }
    .page-head, .article-head, .resume-head { padding-top: 44px; }
    .site-nav .links { gap: 16px; }
    .entry { grid-template-columns: 1fr; }
    .entry .entry-side { grid-column: 1; grid-row: auto; padding-top: 2px; }
}

/* ── Glass nav: translucent, blurred, stays on top while scrolling ── */
.site-nav {
    position: sticky; top: 0; z-index: 50;
    max-width: none;
    padding: 18px max(24px, calc((100% - var(--measure)) / 2 + 24px));
    background: rgba(252, 252, 253, 0.72);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
    backdrop-filter: saturate(180%) blur(18px);
    border-bottom: 1px solid rgba(21, 23, 28, 0.06);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .site-nav { background: var(--paper); }
}

/* Name in the nav says hola on hover */
.site-nav .brand { position: relative; display: inline-block; }
.site-nav .brand .alt { position: absolute; left: 0; top: 0; opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; color: var(--swift); white-space: nowrap; }
.site-nav .brand .main { display: inline-block; transition: opacity .2s, transform .2s; }
.site-nav .brand.say-hola .main, .site-nav .brand:focus-visible .main { opacity: 0; transform: translateY(-6px); }
.site-nav .brand.say-hola .alt, .site-nav .brand:focus-visible .alt { opacity: 1; transform: none; }
@media (hover: hover) {
    .site-nav .brand:hover .main { opacity: 0; transform: translateY(-6px); }
    .site-nav .brand:hover .alt { opacity: 1; transform: none; }
}

/* Typed headline */
.hero h1 { cursor: text; -webkit-tap-highlight-color: transparent; }
.hero h1.has-typing { position: relative; }
.hero h1.has-typing::after { display: none; }
.hero h1 .ghost { visibility: hidden; }
.hero h1 .ghost, .hero h1 .typed { white-space: pre-line; }
.hero h1 .type-layer { position: absolute; inset: 0; }
.hero h1 .caret {
    display: inline-block; width: 0.09em; height: 0.82em; margin-left: 0.08em;
    background: var(--swift); vertical-align: -0.06em;
    animation: caret 1.1s steps(1) infinite;
}
.hero h1.is-typing .caret { animation: none; }
@media (prefers-reduced-motion: reduce) { .hero h1 .caret { animation: none; } }

/* Rows: a soft glass highlight on hover */
.entry { position: relative; transition: background-color .2s; }
.entry::before { content: ""; position: absolute; inset: 0 -14px; border-radius: 12px; background: rgba(21, 23, 28, 0.035); opacity: 0; transition: opacity .2s; pointer-events: none; }
@media (hover: hover) { .entry:hover::before { opacity: 1; } }
.entry:active::before { opacity: 1; }

/* Code blocks get a copy button on hover */
pre { position: relative; }
.copy-code {
    position: absolute; top: 10px; right: 10px;
    font-family: var(--sans); font-size: 0.78rem; font-weight: 500;
    color: var(--graphite);
    background: rgba(255, 255, 255, 0.7);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    border: 1px solid var(--hairline); border-radius: 6px;
    padding: 3px 9px; cursor: pointer;
    opacity: 0; transition: opacity .15s;
}
pre:hover .copy-code, .copy-code:focus-visible { opacity: 1; }
@media (hover: none) { .copy-code { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
    .site-nav .brand .main, .site-nav .brand .alt, .entry::before { transition: none; }
}
@media (max-width: 560px) {
    .site-nav { padding-top: 12px; padding-bottom: 12px; row-gap: 6px; }
    .site-nav .links { font-size: 0.9rem; }
}

/* ──────────────────────────────────────────────────────────────
   Dark mode: same structure, inverted tokens. Follows the visitor's
   system setting. Text stays above 7:1 contrast on the background.
   ────────────────────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
    :root {
        --paper: #101114;
        --ink: #ECEDEF;
        --graphite: #A9AEB9;
        --mist: #7D828E;
        --hairline: #26282E;
        --wash: #18191D;
        --bs-link-color-rgb: 236, 237, 239;
        color-scheme: dark;
    }

    .site-nav {
        background: rgba(16, 17, 20, 0.72);
        border-bottom-color: rgba(236, 237, 239, 0.07);
    }

    .btn-primary { background: var(--ink); border-color: var(--ink); color: var(--paper); }
    .btn-primary:hover, .btn-primary:focus { background: #D3D5DA; border-color: #D3D5DA; color: var(--paper); }
    .btn-secondary { border-color: #33363D; }

    .entry::before { background: rgba(236, 237, 239, 0.04); }
    .copy-code { background: rgba(24, 25, 29, 0.75); }

    /* Code colors adapted from Xcode's dark theme */
    code[class*="language-"], pre[class*="language-"] { color: var(--ink); }
    .token.comment { color: #7F8C98; }
    .token.keyword, .token.tag, .token.selector-tag { color: #FF7AB2; }
    .token.string, .token.attr-value { color: #FF8170; }
    .token.number, .token.symbol, .token.constant { color: #D9C97C; }
    .token.regex, .token.important { color: #78C2B3; }
    .token.property, .token.attr-name { color: #FFA14F; }
    .token.function, .token.variable { color: #67B7A4; }
    .token.class-name, .token.builtin { color: #DABAFF; }
    .token.operator, .token.punctuation { color: var(--ink); }
    .token.meta { color: #FD8F3F; }
}

/* ── About: portrait ──────────────────────────────────────── */
.about-head .portrait {
    display: block;
    width: 132px;
    height: 132px;
    object-fit: cover;
    border-radius: 28px;
    margin-bottom: 28px;
    box-shadow: 0 0 0 1px var(--hairline);
}
@media (max-width: 560px) {
    .about-head .portrait { width: 112px; height: 112px; border-radius: 24px; }
}

/* Tables: override Bootstrap's table colors so text follows light/dark mode */
.table {
    --bs-table-color: var(--graphite);
    --bs-table-bg: transparent;
    --bs-table-border-color: var(--hairline);
    --bs-table-striped-color: var(--graphite);
    --bs-table-hover-color: var(--ink);
    color: var(--graphite);
}
.table > :not(caption) > * > * { color: var(--graphite); padding-left: 0; }
.table > thead > tr > th { color: var(--ink); border-bottom-color: var(--ink); }
.table > tbody > tr > td:first-child { color: var(--ink); }

/* About page section headings: h2 for document order, sized like small headings */
.about-section h2 { font-size: 1.15rem; margin-top: 2rem; margin-bottom: 0.5rem; letter-spacing: -0.01em; }

.article-head .repo-links { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 0.75rem; }
.article-head .repo-links .btn { margin-top: 0; }



/* ── Step containers in posts ─────────────────────────────── */
.steps { list-style: none; padding: 0 !important; margin: 1.5rem 0 2rem; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; counter-reset: none; }
.steps li { position: relative; margin: 0 !important; padding: 14px 14px 16px; border: 1px solid var(--hairline); border-radius: 12px; background: var(--wash); display: flex; flex-direction: column; gap: 4px; }
.steps li::marker { content: none; }
.steps li + li::before { content: ""; position: absolute; left: -17px; top: 50%; width: 12px; height: 12px; border-top: 1.5px solid var(--mist); border-right: 1.5px solid var(--mist); transform: translateY(-50%) rotate(45deg); }
.steps .step-n { font: 500 0.75rem var(--mono); color: var(--mist); }
.steps strong { font-size: 0.98rem; color: var(--ink); }
.steps span:last-child { font-size: 0.85rem; line-height: 1.45; color: var(--graphite); }
.steps li.key { border-color: var(--swift); background: var(--paper); }
.steps li.key .step-n { color: var(--swift); }
@media (max-width: 640px) {
    .steps { grid-template-columns: 1fr; gap: 18px; }
    .steps li + li::before { left: 50%; top: -14px; transform: translateX(-50%) rotate(135deg); }
}

/* ── Figma-style wireframe board in posts ─────────────────── */
.board {
    --canvas: #F5F5F5; --line: #8A8F9C; --wire-ink: #3A3E48; --wire-bg: #FFFFFF;
    margin: 1.75rem 0 2rem; padding: 18px 20px 14px; border: 1px solid var(--hairline); border-radius: 14px;
    background: var(--canvas);
}
.board-title { margin: 0 0 12px; font-size: 0.95rem; font-weight: 500; color: var(--wire-ink); }
.board-row { display: flex; align-items: center; justify-content: center; }
.board-screens { gap: 16px; margin-bottom: 26px; }
.frame { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.frame-label { margin: 0; font-size: 0.8rem; color: var(--wire-ink); }
.wire { background: var(--wire-bg); border: 1.25px solid var(--line); }
.phone { width: 168px; height: 214px; border-radius: 4px; padding: 14px 12px; display: flex; flex-direction: column; align-items: center; gap: 9px; }
.ph { margin: 0; font-size: 0.72rem; color: var(--wire-ink); }
.ph-lg { font-size: 0.95rem; margin: 2px 0; }
.ph-sm { font-size: 0.64rem; color: var(--line); }
.ph-box { width: 100%; border: 1.25px solid var(--line); border-radius: 4px; padding: 10px 6px; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.ph-pill { font-size: 0.7rem; color: var(--wire-ink); border: 1.25px solid var(--line); border-radius: 999px; padding: 5px 12px; }
.ph-pill.key { border-color: var(--swift); }
.ph-row { width: 100%; display: flex; align-items: center; gap: 8px; border: 1.25px solid var(--line); border-radius: 4px; padding: 5px 8px; }
.ph-check { width: 11px; height: 11px; border-radius: 50%; border: 1.25px solid var(--line); flex: none; }
.ph-row.done .ph-check { background: var(--swift); border-color: var(--swift); }
.board-arrow { width: 34px; height: 1.25px; background: var(--line); position: relative; flex: none; }
.board-arrow::after, .loop-arrow::after { content: ""; position: absolute; right: 0; top: -3.5px; width: 7px; height: 7px; border-top: 1.25px solid var(--line); border-right: 1.25px solid var(--line); transform: rotate(45deg); }
.board-loop { gap: 0; align-items: flex-start; }
.loop-box { flex: 1 1 0; min-width: 0; border-radius: 4px; padding: 9px 10px; display: flex; flex-direction: column; gap: 2px; }
.loop-box strong { font-size: 0.8rem; font-weight: 600; color: var(--wire-ink); }
.loop-box span { font-size: 0.72rem; line-height: 1.35; color: var(--wire-ink); opacity: 0.8; }
.loop-gap { flex: 0 0 76px; display: flex; flex-direction: column; align-items: center; padding-top: 20px; gap: 10px; }
.loop-arrow { width: 40px; height: 1.25px; background: var(--line); position: relative; }
.sticky { margin: 0; width: 72px; min-height: 56px; padding: 7px 6px 8px 16px; font-size: 0.68rem; line-height: 1.25; color: #2E2A1A; background: #FFE29B; box-shadow: 0 2px 4px rgba(21, 23, 28, 0.14); }
.sticky li { margin: 0; color: #2E2A1A; }
.sticky li::marker { color: #2E2A1A; }
.board figcaption { margin-top: 16px; font-size: 0.85rem; color: var(--graphite); }
@media (prefers-color-scheme: dark) {
    .board { --canvas: #1E1E1E; --line: #7C8190; --wire-ink: #D9DBE1; --wire-bg: #262626; }
}
@media (max-width: 640px) {
    .board-screens { flex-direction: column; }
    .board-arrow { width: 1.25px; height: 24px; }
    .board-arrow::after { right: -3px; top: auto; bottom: 0; transform: rotate(135deg); }
    .board-loop { flex-direction: column; align-items: stretch; }
    .loop-gap { flex: none; flex-direction: row; justify-content: center; padding: 8px 0; gap: 14px; }
    .loop-arrow { width: 1.25px; height: 22px; }
    .loop-arrow::after { right: -3px; top: auto; bottom: 0; transform: rotate(135deg); }
    .sticky { width: auto; min-height: 0; }
}
