/* ------------------------------------------------------------------
   Sharon Tse — Personal Portfolio
   Hand-written, dependency-free CSS. Light + dark mode via tokens.
   ------------------------------------------------------------------ */

:root {
  --bg: #faf8f4;
  --bg-elev: #ffffff;
  --bg-soft: #f1ede6;
  --ink: #1b1a17;
  --ink-2: #4b4741;
  --ink-3: #7c766d;
  --line: #e4dfd6;
  --accent: #0f6b5c;
  --accent-ink: #ffffff;
  --accent-soft: #e2f0ec;
  --shadow: 0 1px 2px rgba(27, 26, 23, .06), 0 12px 32px -16px rgba(27, 26, 23, .18);

  --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --maxw: 1120px;
  --gutter: clamp(16px, 4vw, 40px);
  --radius: 14px;
  --radius-sm: 8px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14130f;
    --bg-elev: #1d1b17;
    --bg-soft: #22201b;
    --ink: #f2eee7;
    --ink-2: #c9c3b8;
    --ink-3: #8f887c;
    --line: #2e2b25;
    --accent: #6fcbb6;
    --accent-ink: #0e1f1b;
    --accent-soft: #1a2d29;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px -16px rgba(0, 0, 0, .6);
  }
}
:root[data-theme="dark"] {
  --bg: #14130f;
  --bg-elev: #1d1b17;
  --bg-soft: #22201b;
  --ink: #f2eee7;
  --ink-2: #c9c3b8;
  --ink-3: #8f887c;
  --line: #2e2b25;
  --accent: #6fcbb6;
  --accent-ink: #0e1f1b;
  --accent-soft: #1a2d29;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px -16px rgba(0, 0, 0, .6);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 500; line-height: 1.12; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(2.4rem, 6vw, 4.6rem); }
h2 { font-size: clamp(1.7rem, 3.2vw, 2.5rem); }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); }
p { margin: 0 0 1.1em; }
p:last-child { margin-bottom: 0; }
ul, ol { padding-left: 1.3em; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
.eyebrow {
  display: inline-block; font-size: .78rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 14px;
}
.lede { font-size: clamp(1.05rem, 1.5vw, 1.3rem); color: var(--ink-2); max-width: 46ch; }
.muted { color: var(--ink-3); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 8px; top: -48px; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: var(--radius-sm); z-index: 100; }
.skip-link:focus { top: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(150%) blur(12px);
  -webkit-backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.brand { font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; color: var(--ink); letter-spacing: .02em; }
.brand:hover { text-decoration: none; }
.nav { display: flex; align-items: center; gap: 6px; }
.nav a { color: var(--ink-2); font-size: .92rem; font-weight: 500; padding: 8px 12px; border-radius: 999px; }
.nav a:hover { background: var(--bg-soft); text-decoration: none; color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--bg-soft); }
.nav-toggle, .theme-toggle { background: none; border: 1px solid var(--line); color: var(--ink); width: 40px; height: 40px; border-radius: 10px; cursor: pointer; }
.nav-toggle { display: none; }
.theme-toggle { display: inline-grid; place-items: center; margin-left: 6px; }
.theme-toggle:hover { background: var(--bg-soft); }
.theme-toggle svg { width: 18px; height: 18px; }
@media (max-width: 720px) { .theme-toggle { margin: 8px 0 0; width: 100%; height: 44px; } }
.nav-toggle span { display: block; width: 18px; height: 2px; background: currentColor; margin: 4px auto; transition: transform .2s; }
@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .nav {
    position: absolute; left: 0; right: 0; top: 64px; flex-direction: column; align-items: stretch;
    background: var(--bg-elev); border-bottom: 1px solid var(--line); padding: 10px var(--gutter) 16px; gap: 2px;
    display: none;
  }
  .nav.is-open { display: flex; }
  .nav a { padding: 12px 14px; border-radius: var(--radius-sm); }
}

/* ---------- Hero (home) ----------
   Mirrors the Wix layout: the abstract image fills the left half of the
   viewport edge-to-edge as a background; the text sits centred on the right. */
.hero {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: calc(100svh - 64px);
  border-bottom: 1px solid var(--line);
}
.hero-bg { position: relative; overflow: hidden; background: var(--bg-soft); }
.hero-bg img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 50%; }
.hero-bg::after { /* soft fade into the page background along the right edge */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to right, transparent 70%, var(--bg));
}
.hero-text {
  align-self: center;
  padding: clamp(56px, 8vw, 120px) var(--gutter) clamp(56px, 8vw, 120px) clamp(32px, 6vw, 96px);
  max-width: 720px;
}
.hero h1 { margin-bottom: 18px; text-wrap: balance; }
.hero h1 em { font-style: italic; color: var(--accent); }
.hero .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 28px; }
.btn-icon { width: 46px; height: 46px; padding: 0; justify-content: center; border-color: var(--line); color: var(--ink-2); background: var(--bg-elev); }
.btn-icon:hover { color: var(--accent); background: var(--bg-soft); }
.btn-icon svg { width: 20px; height: 20px; }
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; min-height: 0; }
  .hero-bg { min-height: 42svh; }
  .hero-bg::after { background: linear-gradient(to bottom, transparent 70%, var(--bg)); }
  .hero-text { padding: 32px var(--gutter) 56px; max-width: none; }
}
/* Light/dark variants of the hero artwork (profile-dark.jpg is an inverted version tuned to the dark background) */
.dark-only { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .light-only { display: none; }
  :root:not([data-theme="light"]) .dark-only { display: block; }
}
:root[data-theme="dark"] .light-only { display: none; }
:root[data-theme="dark"] .dark-only { display: block; }
:root[data-theme="light"] .light-only { display: block; }
:root[data-theme="light"] .dark-only { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 20px; border-radius: 999px;
  font-weight: 600; font-size: .95rem; border: 1px solid transparent; transition: transform .15s, background .15s;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost { border-color: var(--line); color: var(--ink); background: var(--bg-elev); }
.btn-ghost:hover { background: var(--bg-soft); }
.btn svg { width: 18px; height: 18px; flex: none; }

/* ---------- Sections ---------- */
.section { padding: clamp(48px, 8vw, 96px) 0; }
.section + .section { border-top: 1px solid var(--line); }
.section-head { max-width: 62ch; margin-bottom: clamp(28px, 4vw, 48px); }
.section-head p { color: var(--ink-2); }

/* Industries timeline */
.industries { display: grid; grid-template-columns: repeat(5, 1fr); gap: 18px; list-style: none; padding: 0; margin: 0; }
.industry {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px;
  display: flex; flex-direction: column; gap: 14px; transition: transform .2s, box-shadow .2s;
}
.industry:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.industry .icon { width: 52px; height: 52px; border-radius: 12px; background: var(--accent-soft); display: grid; place-items: center; }
.industry .icon img { width: 30px; height: 30px; object-fit: contain; }
.industry .years { font-size: .8rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.industry h3 { font-family: var(--font-body); font-size: 1.05rem; font-weight: 600; margin: 0; }
@media (max-width: 1000px) { .industries { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) { .industries { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 420px) { .industries { grid-template-columns: 1fr; } }

/* Experience areas */
.areas { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; list-style: none; padding: 0; margin: 0; }
.area { position: relative; border-radius: var(--radius); overflow: hidden; aspect-ratio: 1 / 1; background: var(--bg-soft); }
.area img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.area:hover img { transform: scale(1.04); }
.area .label {
  position: absolute; inset: auto 0 0 0; padding: 40px 18px 16px; color: #fff; font-weight: 600; font-size: 1rem;
  background: linear-gradient(to top, rgba(0, 0, 0, .72), rgba(0, 0, 0, 0));
}
@media (max-width: 900px) { .areas { grid-template-columns: repeat(2, 1fr); } }

/* Education */
.edu { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; list-style: none; padding: 0; margin: 0; }
.edu li { border-left: 3px solid var(--accent); padding: 4px 0 4px 20px; }
.edu .degree { font-weight: 600; display: block; }
.edu .school { color: var(--ink-2); display: block; }
.edu .years { color: var(--ink-3); font-size: .9rem; }
@media (max-width: 700px) { .edu { grid-template-columns: 1fr; } }

/* Contact band */
.contact {
  background: var(--accent); color: var(--accent-ink); border-radius: var(--radius); padding: clamp(28px, 5vw, 56px);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px;
}
.contact h2 { color: inherit; margin: 0 0 6px; }
.contact p { color: inherit; opacity: .9; margin: 0; max-width: 50ch; }
.contact .btn { background: var(--accent-ink); color: var(--accent); }

/* ---------- Portfolio grid ---------- */
.page-hero { padding: clamp(48px, 8vw, 100px) 0 clamp(28px, 5vw, 56px); }
.page-hero h1 { margin-bottom: 14px; }
.projects { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; list-style: none; padding: 0; margin: 0; }
.project-card {
  display: flex; flex-direction: column; background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; color: inherit; transition: transform .2s, box-shadow .2s; height: 100%;
}
.project-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); text-decoration: none; }
.project-card .thumb { aspect-ratio: 4 / 3; overflow: hidden; background: var(--bg-soft); }
.project-card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.project-card:hover .thumb img { transform: scale(1.04); }
.project-card .body { padding: 20px 22px 24px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.project-card h3 { margin: 0; }
.project-card .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 6px; }
.tag { font-size: .75rem; font-weight: 600; letter-spacing: .02em; padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.project-card .more { align-self: flex-start; margin-top: 12px; padding: 10px 16px; font-size: .9rem; pointer-events: none; }
.project-card:hover .more, .project-card:focus-visible .more { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
@media (max-width: 900px) { .projects { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .projects { grid-template-columns: 1fr; } }

/* ---------- Case study pages ---------- */
.case-hero { padding: clamp(40px, 7vw, 88px) 0 0; }
.case-hero .wrap { display: grid; grid-template-columns: 1fr; gap: 28px; }
.case-hero h1 { margin-bottom: 12px; }
.case-hero .meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.case-hero figure { margin: clamp(24px, 4vw, 48px) 0 0; }
.case-hero figure img { width: 100%; aspect-ratio: 16 / 7; object-fit: cover; border-radius: var(--radius); box-shadow: var(--shadow); }

.case-body { padding: clamp(40px, 6vw, 80px) 0; }
.case-body .wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(40px, 6vw, 72px); }
.case-section { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: clamp(20px, 4vw, 56px); align-items: start; }
.case-section > h2 { font-size: 1.35rem; position: sticky; top: 88px; margin: 0; }
.case-section .content { max-width: 68ch; }
.case-section .content.wide { max-width: none; }
.callout { background: var(--bg-soft); border-left: 3px solid var(--accent); padding: 16px 20px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 0 0 1.1em; }
.callout strong { color: var(--accent); }
.deliverables { counter-reset: d; list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 10px; }
.deliverables li { counter-increment: d; display: flex; gap: 14px; align-items: baseline; padding: 12px 16px; background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.deliverables li::before { content: counter(d, decimal-leading-zero); font-family: var(--font-display); color: var(--accent); font-size: 1.1rem; min-width: 2ch; }
@media (max-width: 800px) {
  .case-section { grid-template-columns: 1fr; gap: 12px; }
  .case-section > h2 { position: static; }
}

/* Figures & galleries */
figure { margin: 0; }
figcaption { font-size: .88rem; color: var(--ink-3); margin-top: 10px; }
.frame { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.frame img { border-radius: var(--radius-sm); width: 100%; }
.stack { display: grid; gap: 28px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 800px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
.tall-grid .frame img { max-height: 720px; width: auto; margin: 0 auto; }
.before-row { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.before-row .frame { flex: 0 1 260px; }
.before-row img { width: 100%; }

/* Horizontal scroller (replaces Wix carousels) */
.scroller { position: relative; }
.scroller .track {
  display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 4px 14px;
  scrollbar-width: thin; -webkit-overflow-scrolling: touch;
}
.scroller .track > * { flex: 0 0 auto; scroll-snap-align: start; width: min(260px, 70vw); }
.scroller .track img { width: 100%; aspect-ratio: 9 / 16; object-fit: contain; background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.scroller .track.landscape > * { width: min(560px, 85vw); }
.scroller .track.landscape img { aspect-ratio: 16 / 9; object-fit: contain; }
.scroller-nav { display: flex; gap: 8px; justify-content: flex-end; margin-bottom: 10px; }
.scroller-nav button {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg-elev); color: var(--ink); cursor: pointer;
  display: grid; place-items: center;
}
.scroller-nav button:hover { background: var(--bg-soft); }
.scroller-nav svg { width: 16px; height: 16px; }

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .86); display: none; place-items: center; z-index: 200; padding: 24px; cursor: zoom-out;
}
.lightbox.is-open { display: grid; }
.lightbox img { max-width: 100%; max-height: 100%; width: auto; height: auto; border-radius: var(--radius-sm); background: #fff; }
[data-zoom] { cursor: zoom-in; }

/* Next project */
.next {
  border-top: 1px solid var(--line); padding: clamp(40px, 6vw, 72px) 0;
}
.next a {
  display: grid; grid-template-columns: 1fr 260px; gap: 28px; align-items: center; color: inherit; background: var(--bg-elev);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: transform .2s, box-shadow .2s;
}
.next a:hover { transform: translateY(-3px); box-shadow: var(--shadow); text-decoration: none; }
.next .text { padding: clamp(22px, 4vw, 40px); }
.next .text h2 { margin: 6px 0 0; }
.next img { width: 100%; height: 100%; min-height: 180px; object-fit: cover; }
@media (max-width: 640px) { .next a { grid-template-columns: 1fr; } .next img { order: -1; max-height: 200px; } }

/* ---------- Password gate (portfolio section) ---------- */
.gate { padding: clamp(56px, 12vw, 140px) 0; min-height: calc(100svh - 64px - 120px); display: grid; align-items: center; }
.gate-card { max-width: 520px; margin: 0 auto; background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(28px, 5vw, 48px); box-shadow: var(--shadow); }
.gate-card h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); margin-bottom: 10px; }
.gate-form { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.gate-form input {
  flex: 1 1 200px; font: inherit; padding: 12px 16px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); min-width: 0;
}
.gate-form input:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.gate-modal { border: 0; padding: 0; background: transparent; max-width: min(560px, calc(100vw - 32px)); width: 100%; }
.gate-modal::backdrop { background: rgba(20, 19, 15, .55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.gate-modal[open] { animation: gate-in .18s ease-out; }
.gate-modal .gate-card { max-width: none; }
.gate-modal h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); margin-bottom: 8px; }
@keyframes gate-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.gate-form.is-busy .btn { opacity: .6; pointer-events: none; }
.gate-error { color: #b4413c; font-size: .92rem; margin: 12px 0 0; }
:root[data-theme="dark"] .gate-error { color: #f09a95; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .gate-error { color: #f09a95; } }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 36px 0 48px; color: var(--ink-3); font-size: .9rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; align-items: center; }
.site-footer nav { display: flex; gap: 18px; }
.site-footer a { color: var(--ink-2); }
.social { display: inline-flex; align-items: center; gap: 8px; }
.social svg { width: 18px; height: 18px; }

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