/* Portfolio page styles. */

:root {
    --bg: #f4f2ee;
    --card: #ffffff;
    --fg: #141414;
    --muted: #6c6a66;
    --line: #e0ddd6;
    --soft: #ebe8e1;
    --brand: #141414;
    --shadow: 0 24px 60px -24px rgb(0 0 0 / 0.3);
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0e0e0f;
        --card: #18181a;
        --fg: #f1f0ed;
        --muted: #9b9994;
        --line: #2b2b2e;
        --soft: #222225;
        --shadow: 0 24px 60px -24px rgb(0 0 0 / 0.8);
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --bg: #0e0e0f;
    --card: #18181a;
    --fg: #f1f0ed;
    --muted: #9b9994;
    --line: #2b2b2e;
    --soft: #222225;
    --shadow: 0 24px 60px -24px rgb(0 0 0 / 0.8);
    color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: "Geist", system-ui, sans-serif;
    font-size: 1.0625rem;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }

h1, h2, h3 {
    font-family: "Fraunces", Georgia, serif;
    font-weight: 600;
    letter-spacing: -0.02em;
}

h1 em, h2 em { font-weight: 400; }

main {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 24px 40px;
}

/* Top bar */

.top {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 24px;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: inherit;
    font-weight: 600;
    text-decoration: none;
    min-width: 0;
}

.brand > span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand em { color: var(--muted); font-style: normal; font-weight: 500; }

.logo {
    display: grid;
    place-items: center;
    flex: none;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: var(--fg);
    color: var(--bg);
    font-size: 0.8rem;
    font-weight: 700;
}

.top-cta {
    flex: none;
    padding: 8px 16px;
    border-radius: 999px;
    background: var(--fg);
    color: var(--bg);
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
}

/* Hero */

.hero { padding: clamp(48px, 9vw, 110px) 0 clamp(40px, 6vw, 72px); }

.kicker {
    margin: 0 0 16px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hero h1 {
    max-width: 14ch;
    margin: 0;
    font-size: clamp(2.75rem, 7vw, 5.5rem);
    line-height: 1;
    letter-spacing: -0.03em;
}

.lead {
    max-width: 60ch;
    margin: 24px 0 48px;
    color: var(--muted);
    font-size: clamp(1.1rem, 1.6vw, 1.3125rem);
}

.kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--card);
    overflow: hidden;
}

.kpis div { padding: 22px 24px; border-left: 1px solid var(--line); }
.kpis div:first-child { border-left: 0; }

.kpis dt {
    font-family: "Fraunces", Georgia, serif;
    font-size: clamp(1.75rem, 3.2vw, 2.75rem);
    font-weight: 600;
    line-height: 1.05;
    letter-spacing: -0.02em;
}

.kpis dt { white-space: nowrap; }
.kpis dt.long { font-size: clamp(1.5rem, 2.6vw, 2.35rem); }
.kpis dt small { font-size: 0.5em; color: var(--muted); font-weight: 400; }

.kpis dd {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 0.95rem;
    font-weight: 500;
}

/* Section heads */

.section-head { margin-bottom: 20px; }
.section-head h2 { margin: 0; font-size: clamp(2rem, 4vw, 3rem); line-height: 1.05; }
.section-head p { margin: 8px 0 0; color: var(--muted); }

/* Brand selector */

.brands {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 28px;
}

.brand-btn {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    min-height: 112px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--card);
    text-align: left;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.brand-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.brand-btn:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }

.brand-btn .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--c);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 18%, transparent);
}

.brand-btn b { font-size: 1.02rem; line-height: 1.2; }
.brand-btn small { margin-top: auto; color: var(--muted); font-size: 0.85rem; }

.brand-btn[aria-pressed="true"] {
    border-color: var(--fg);
    background: var(--fg);
    color: var(--bg);
    box-shadow: var(--shadow);
}

.brand-btn[aria-pressed="true"] small { color: color-mix(in srgb, var(--bg) 70%, transparent); }

.brand-btn[aria-pressed="true"]::after {
    content: "";
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: -1px;
    height: 4px;
    border-radius: 4px 4px 0 0;
    background: var(--c);
}

/* Panel + flow */

.panel {
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--card);
    padding: 24px;
}

.panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.panel-head h3, .lib-head h3 { margin: 0; font-size: 1.75rem; line-height: 1.1; }
.panel-head p { margin: 6px 0 0; color: var(--muted); font-size: 0.95rem; max-width: 70ch; }

.ghost, .solid {
    flex: none;
    padding: 8px 16px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
}

.ghost { border: 1px solid var(--line); background: transparent; }
.ghost:hover { border-color: var(--fg); }
.solid { border: 0; background: var(--fg); color: var(--bg); padding: 12px 20px; font-size: 1rem; }

.flow-wrap {
    overflow-x: auto;
    margin: 0 -8px;
    padding: 0 8px 4px;
}

.flow {
    display: block;
    width: 100%;
    min-width: 1040px;
    height: auto;
    font-family: "Geist", system-ui, sans-serif;
}

.flow .col-label {
    fill: var(--muted);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: pre;
}

.flow .link { opacity: 0.22; transition: opacity 0.25s; }
.flow.has-sel .link { opacity: 0.07; }
.flow .link-hi { opacity: 0.75; pointer-events: none; }

.flow .node { cursor: pointer; }
.flow .node rect { rx: 2; transition: opacity 0.25s; }

.flow .node text {
    fill: var(--fg);
    font-size: 15px;
    font-weight: 500;
    paint-order: stroke;
    stroke: var(--card);
    stroke-width: 4px;
    stroke-linejoin: round;
}

.flow .node text tspan.n { fill: var(--muted); font-weight: 400; }
.flow .node:hover text { text-decoration: underline; }
.flow.has-sel .node:not(.is-hit) rect { opacity: 0.25; }
.flow.has-sel .node:not(.is-hit) text { opacity: 0.4; }
.flow .node.is-sel rect { stroke: var(--fg); stroke-width: 2.5; }
.flow .node.is-sel text { font-weight: 700; }
.flow .node:focus { outline: none; }
.flow .node:focus-visible rect { stroke: var(--fg); stroke-width: 3; }

/* Library */

.lib-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px 16px;
    margin: 48px 0 24px;
}

.lib-head p { margin: 4px 0 0; color: var(--muted); }

.seg {
    display: inline-flex;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--card);
}

.seg button {
    padding: 7px 16px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.seg button em { margin-left: 4px; font-style: normal; font-weight: 500; opacity: 0.7; font-variant-numeric: tabular-nums; }
.seg button:hover { color: var(--fg); }
.seg button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }
.seg button:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }

.lib {
    columns: 4 240px;
    column-gap: 24px;
}

.batch {
    display: block;
    width: 100%;
    margin: 0 0 26px;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    text-align: left;
    cursor: pointer;
    break-inside: avoid;
}

.batch:focus-visible { outline: none; }
.batch:focus-visible .card { outline: 2px solid var(--fg); outline-offset: 3px; }

.stack { position: relative; margin: 8px 6px 0; }

.card {
    position: relative;
    z-index: 2;
    padding: 8px 8px 14px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--card);
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 8px 24px -12px rgb(0 0 0 / 0.12);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s;
}

.stack .layer {
    position: absolute;
    inset: 0;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--card);
    transition: transform 0.25s ease;
}

.stack .l1 { z-index: 1; transform: rotate(-2.5deg) translate(-4px, 3px); }
.stack .l2 { z-index: 0; transform: rotate(2.5deg) translate(5px, -2px); background: var(--soft); }

.batch:hover .card {
    border-color: color-mix(in srgb, var(--fg) 30%, var(--line));
    transform: translateY(-3px);
    box-shadow: 0 2px 4px rgb(0 0 0 / 0.04), 0 18px 40px rgb(0 0 0 / 0.12);
}

.batch:hover .l1 { transform: rotate(-4.5deg) translate(-9px, 3px); }
.batch:hover .l2 { transform: rotate(4.5deg) translate(10px, -3px); }

.media { position: relative; }

.badge {
    position: absolute;
    z-index: 3;
    top: 10px;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgb(0 0 0 / 0.62);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    backdrop-filter: blur(6px);
}

.badge.count { right: 10px; }
.badge.kind { left: 10px; }

.eyebrow {
    margin: 12px 6px 4px;
    overflow: hidden;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.hook {
    display: -webkit-box;
    margin: 0 6px 12px;
    overflow: hidden;
    font-size: 1.02rem;
    font-weight: 600;
    line-height: 1.35;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 6px; }

.tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 9px;
    border-radius: 99px;
    background: var(--soft);
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
}

.tag i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }

.empty {
    padding: 40px;
    border: 1px dashed var(--line);
    border-radius: 16px;
    color: var(--muted);
    text-align: center;
}

.note { color: var(--muted); font-size: 0.85rem; }

/* Media frames: 9:16 for video, 1:1 for statics. Contain, never crop or stretch. */

.frame {
    position: relative;
    z-index: 2;
    width: 100%;
    overflow: hidden;
    border-radius: 14px;
    background: #0d0d0d;
}

.frame.v { aspect-ratio: 9 / 16; }
.frame.s { aspect-ratio: 1 / 1; background: var(--soft); }

.frame > img,
.frame > video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.frame .play {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 52px;
    height: 52px;
    margin: -26px 0 0 -26px;
    border-radius: 50%;
    background: rgb(0 0 0 / 0.55);
    backdrop-filter: blur(6px);
}

.frame .play::after {
    content: "";
    position: absolute;
    left: 21px;
    top: 16px;
    border-left: 16px solid #fff;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
}

.frame.playing .play { display: none; }

.frame .pending {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgb(0 0 0 / 0.62);
    color: #fff;
    font-size: 0.8rem;
    line-height: 1.35;
    text-align: center;
}

/* Detail dialog */

.detail {
    width: min(1120px, calc(100vw - 32px));
    max-height: calc(100dvh - 32px);
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: var(--card);
    color: var(--fg);
    box-shadow: var(--shadow);
    overflow: auto;
}

.detail::backdrop { background: rgb(10 10 10 / 0.6); backdrop-filter: blur(4px); }

.close {
    position: sticky;
    z-index: 5;
    top: 12px;
    float: right;
    width: 40px;
    height: 40px;
    margin: 12px 12px -52px 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--card);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.d-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: 32px;
    padding: 28px;
}

.d-media { min-width: 0; }

.d-stage .frame { margin: 0 auto; }
.d-stage .frame.v { width: min(100%, calc((100dvh - 300px) * 9 / 16)); min-width: 220px; }
.d-stage .frame.s { width: min(100%, calc(100dvh - 300px)); min-width: 240px; }

.d-strip {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 16px;
    padding: 4px 2px 8px;
    overflow-x: auto;
}

.thumb {
    flex: none;
    width: 70px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 12px;
    background: none;
    cursor: pointer;
}

.thumb .frame { border-radius: 9px; }
.thumb .frame .play { width: 26px; height: 26px; margin: -13px 0 0 -13px; }
.thumb .frame .play::after { left: 10px; top: 7px; border-left-width: 9px; border-top-width: 6px; border-bottom-width: 6px; }
.thumb small { display: block; margin-top: 4px; overflow: hidden; color: var(--muted); font-size: 0.7rem; text-align: center; white-space: nowrap; text-overflow: ellipsis; }
.thumb[aria-current="true"] { border-color: var(--brand); }
.thumb:focus-visible { outline: 2px solid var(--fg); }

.d-info { min-width: 0; padding-right: 36px; }

.d-info .d-tags { margin: 0 0 18px; }

.d-eyebrow {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.d-hook {
    margin: 0 0 22px;
    font-size: clamp(1.5rem, 2.6vw, 2.15rem);
    line-height: 1.15;
}

.why {
    margin-bottom: 8px;
    padding: 14px 18px;
    border-left: 3px solid var(--brand);
    border-radius: 0 12px 12px 0;
    background: var(--soft);
}

.why strong { font-size: 0.85rem; }
.why p { margin: 4px 0 0; color: var(--muted); }

.d-h {
    margin: 24px 0 10px;
    color: var(--muted);
    font-family: "Geist", system-ui, sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.d-media .d-h { margin: 18px 0 6px; }

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

.path li {
    position: relative;
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 14px;
    padding: 10px 0 10px 30px;
    border-bottom: 1px solid var(--line);
}

.path li::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 17px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--brand);
}

.path li:not(:last-child)::after {
    content: "";
    position: absolute;
    left: 10px;
    top: 28px;
    bottom: -12px;
    width: 1px;
    background: var(--brand);
    opacity: 0.4;
}

.path .k { color: var(--muted); }
.path .v { font-weight: 600; }
.path .v small { display: block; margin-top: 2px; color: var(--muted); font-size: 0.92rem; font-weight: 400; }

.transcript { margin-top: 20px; color: var(--muted); font-size: 0.92rem; }
.transcript summary { cursor: pointer; color: var(--fg); font-weight: 600; }
.transcript p { margin: 10px 0 0; }

.draft { margin-top: 18px; color: var(--muted); font-size: 0.8rem; }

/* Contact */

.contact {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    gap: 40px;
    margin-top: 80px;
    padding: clamp(24px, 5vw, 56px);
    border-radius: 24px;
    background: var(--fg);
    color: var(--bg);
}

.contact .kicker { color: color-mix(in srgb, var(--bg) 65%, transparent); }
.contact h2 { margin: 0; font-size: clamp(2rem, 4vw, 3.25rem); line-height: 1.05; }
.contact-copy p:last-child { color: color-mix(in srgb, var(--bg) 72%, transparent); }

.contact-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.contact-form .wide { grid-column: 1 / -1; }

.contact-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: color-mix(in srgb, var(--bg) 75%, transparent);
}

.contact-form input, .contact-form select, .contact-form textarea {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid color-mix(in srgb, var(--bg) 22%, transparent);
    border-radius: 10px;
    background: color-mix(in srgb, var(--bg) 8%, transparent);
    color: var(--bg);
    font-size: 1rem;
    font-weight: 400;
}

.contact-form select option { color: #141414; }
.contact-form input:focus, .contact-form select:focus, .contact-form textarea:focus { outline: 2px solid var(--bg); outline-offset: 1px; }
.contact-form .solid { background: var(--bg); color: var(--fg); }
.form-status { margin: 0; min-height: 1.5em; font-size: 0.92rem; }

.foot {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    max-width: 1240px;
    margin: 0 auto;
    padding: 24px 24px 40px;
    color: var(--muted);
    font-size: 0.9rem;
}

.foot a { color: inherit; }

/* Responsive */

@media (max-width: 1080px) {
    .brands { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .kpis div:nth-child(3) { border-left: 0; }
    .kpis div:nth-child(n + 3) { border-top: 1px solid var(--line); }


    .d-grid { grid-template-columns: 1fr; gap: 20px; padding: 20px; }
    .d-info { padding-right: 0; }
    .d-stage .frame.v { width: min(100%, 340px); }
    .d-stage .frame.s { width: 100%; }

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

@media (max-width: 560px) {
    main { padding: 0 16px 32px; }
    .top { padding: 12px 16px; }
    .brand em { display: none; }
    .brands { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .brand-btn { min-height: 96px; padding: 14px; }
    .panel { padding: 18px 16px; border-radius: 16px; }
    .panel-head { flex-direction: column; }
    .kpis div { padding: 16px; }
    .kpis dt.long { font-size: 1.3rem; padding-top: 0.25em; }
    .d-info .kicker { font-size: 0.78rem; }
    .lib { columns: 2; column-gap: 12px; }
    .card { padding: 6px 6px 10px; border-radius: 14px; }
    .stack .layer { border-radius: 14px; }
    .hook { font-size: 0.92rem; }
    .tag { font-size: 0.72rem; padding: 2px 7px; }
    .lib-head { align-items: flex-start; flex-direction: column; }
    .batch { margin-bottom: 24px; }
    .stack { margin: 8px 4px 0; }
    .contact-form { grid-template-columns: 1fr; }
    .path li { grid-template-columns: 88px 1fr; }
    .detail { width: 100vw; max-width: 100vw; max-height: 100dvh; border-radius: 0; }
    .foot { padding: 20px 16px 32px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    * { transition: none !important; }
}
