/* About page — builds on styles.css (tokens, header, buttons) */

html { scroll-behavior: smooth; }

/* Section snapping: a light scroll glides to the next section */
@media (min-width: 721px) {
  html { scroll-snap-type: y mandatory; }
  .sec { scroll-snap-align: start; }
  /* a stacked list needs free scrolling through it: snap only near a section start */
  html:has(.stack) { scroll-snap-type: y proximity; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

.nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 1px; }

.about {
  max-width: 1280px; margin: 0 auto; padding: 0 var(--pad-x) 120px;
  box-sizing: content-box;
  display: grid; grid-template-columns: 400px minmax(0, 1fr); gap: 60px;
}

/* ---------- Sidebar ---------- */
.about__side { position: sticky; top: 64px; align-self: start; padding-top: 12px; display: flex; flex-direction: column; align-items: flex-start; gap: 22px; z-index: 6; }
.back {
  display: inline-flex; align-items: center; gap: 6px;
  height: 40px; padding: 0 18px 0 14px; border-radius: 20px;
  background: var(--back-bg); color: #ffffff; font-size: 16px;
  transition: background-color .3s ease;
}
.back:hover { background: var(--back-hover); }
.toc { display: flex; flex-direction: column; gap: 14px; font-size: 16px; color: var(--text); }
.toc a { display: inline-flex; gap: 6px; transition: opacity .2s ease; }
.toc a:hover { opacity: .6; }
.toc a.is-active { font-style: italic; font-weight: 700; }
/* project pages: no fade on hover — underline the item under the pointer so the
   clickable item is obvious */
.page-project .toc a:hover, .page-reading .toc a:hover { opacity: 1; }
.page-project .toc a:hover .toc__label, .page-reading .toc a:hover .toc__label { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.toc a.is-active .toc__label { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }

/* ---------- Sections ---------- */
.about__content { min-width: 0; }
.sec { position: relative; padding: 70px 0 80px; scroll-margin-top: 64px; }
.sec > *:not(.sec__mark) { position: relative; z-index: 1; }
.sec__mark {
  position: absolute; left: -12px; top: 40px; z-index: 0; margin: 0;
  font-family: var(--font); font-weight: 600; font-size: clamp(64px, 11.5vw, 168px);
  line-height: .86; letter-spacing: -0.035em; white-space: nowrap;
  color: var(--mark-color); pointer-events: none; user-select: none;
}
.sec > .sec__mark + * { margin-top: 112px; }
.sec-divider { border: 0; height: 1px; background: linear-gradient(270deg, var(--line), transparent); margin: 0 0 0 -460px; }

/* Intro */
.sec--intro { padding-top: 40px; }
.sec--intro .sec__mark { top: 30px; }
.sec--intro .sec__mark + * { margin-top: 110px; }
.intro-row { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); align-items: end; gap: 56px; }
.intro-row__text { min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.intro-row__hi { font-size: 24px; font-weight: 400; line-height: 1.3; letter-spacing: -0.01em; color: var(--black); }
.intro-row__hi em { font-size: 16px; font-weight: 300; letter-spacing: 0; color: var(--text); }
.intro-row__body { font-size: 16px; font-weight: 300; line-height: 1.6; color: var(--grey-1); }
.intro-row__body strong { font-weight: 500; color: var(--black); }
/* Photo fills the rest of the content column, as big as the grid allows,
   but never taller than one screen (minus header + section padding). */
.intro-row__media {
  position: relative; justify-self: end; width: 100%;
  max-width: calc((100svh - 64px - 80px) * 800 / 1097);
  aspect-ratio: 800 / 1097; background: var(--media-bg); overflow: hidden;
}
.intro-row__photo { display: block; width: 100%; height: 100%; object-fit: cover; }
/* WebGL ripple layer (about.js) — fades in once ready; the <img> is the fallback */
.intro-row__fx { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity .4s ease; }
.intro-row__fx.is-ready { opacity: 1; }

/* Experience */
.jobs { list-style: none; display: flex; flex-direction: column; gap: 34px; }
.job { display: grid; grid-template-columns: 1fr auto; column-gap: 24px; row-gap: 10px; }
.job__company { font-size: 24px; color: var(--black); }
.job__role { font-size: 24px; font-weight: 400; color: var(--black); text-align: right; }
.job__date { grid-column: 1 / -1; font-size: 15px; color: var(--text); }

/* Core value / career goals */
.lead { font-size: 16px; font-weight: 300; line-height: 1.5; color: var(--text); }
.lead--body { margin-top: 44px; }
.lead + .stack { margin-top: 40px; }
.lead + .jobs { margin-top: 40px; }
.stack + .lead--body { margin-top: 24px; }
.lead strong { font-weight: 600; color: var(--black); }
.cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px; margin-top: 40px; }
.sec > .sec__mark + .cols { margin-top: 112px; }
.col h3 { font-size: 24px; font-weight: 400; line-height: 1.3; color: var(--black); }
.col p { margin-top: 14px; font-size: 16px; font-weight: 300; line-height: 1.5; color: var(--muted); }
.dash { display: block; font-size: 16px; color: var(--black); }
.dash + .cols { margin-top: 36px; }

.story { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 470px); gap: 40px; align-items: center; margin-top: 64px; }
.story__quote { font-style: italic; font-size: 16px; font-weight: 300; line-height: 1.5; color: var(--text); max-width: 340px; }
.story__visual { position: relative; height: 290px; }
.story__photo {
  position: absolute; right: 4px; top: 0; width: 266px; height: 258px; object-fit: cover;
  border: 4px solid #1f1f22; border-radius: 12px; rotate: 5deg;
  box-shadow: 0 14px 30px -18px rgba(0, 0, 0, .45);
}
.story__note {
  position: absolute; left: 0; top: 44px; z-index: 1; width: 214px; min-height: 212px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 16px;
  padding: 18px 18px 16px; background: #ead58f; color: #4b4535;
  font-size: 12.5px; line-height: 1.6;
  box-shadow: 0 10px 18px -10px rgba(0, 0, 0, .35);
}
.story__note span { font-size: 12px; color: #5c5232; }

/* References */
.refs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: stretch; }
/* vertical card: photo + name/role side by side, the quote, LinkedIn at the bottom */
.ref { display: flex; flex-direction: column; padding: 6px; background: var(--card); border: 1px solid var(--card-border); border-radius: 24px; }
.ref__head { display: flex; align-items: center; gap: 16px; }
.ref__head > img { flex: none; width: 104px; height: 104px; border-radius: 18px; object-fit: cover; }
.ref__who { min-width: 0; display: flex; flex-direction: column; gap: 4px; padding-right: 10px; }
.ref__name { font-size: 20px; font-weight: 400; line-height: 1.3; color: var(--black); }
.ref__role { font-size: 14px; line-height: 1.4; color: var(--grey-1); }
.ref__body { flex: 1 1 auto; padding: 20px 14px 14px; display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.ref__quote { margin-bottom: auto; font-size: 16px; font-weight: 300; line-height: 1.6; color: var(--text); }
.btn--sm { height: 34px; padding: 0 12px; font-size: 13px; gap: 6px; }
.ref__body .btn--sm { align-self: flex-start; }

/* Scroll-down call to action (mobile only) */
.scroll-cta { display: none; }
@media (max-width: 720px) {
  .scroll-cta {
    display: inline-flex; align-items: center; gap: 6px;
    margin-top: 32px; height: 44px; padding: 0 18px 0 20px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 36px;
    font-size: 15px; font-weight: 500; color: var(--black);
    transition: background-color .3s ease, color .3s ease, border-color .3s ease;
  }
  .scroll-cta:active { background: var(--btn-hover-bg); border-color: var(--btn-hover-bg); color: var(--btn-hover-fg); }
  .scroll-cta svg { animation: cta-nudge 2.4s ease-in-out infinite; }
}
@keyframes cta-nudge { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(3px); } }
@media (prefers-reduced-motion: reduce) { .scroll-cta svg { animation: none; } }

/* ---------- Tablet ---------- */
@media (max-width: 1100px) {
  .about { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .about__side {
    flex-direction: row; align-items: center; gap: 16px;
    margin: 0 calc(var(--pad-x) * -1); padding: 10px 0 10px var(--pad-x);
    background: var(--bar-bg);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  }
  /* Back stays fixed on the left; only the menu scrolls horizontally */
  .back { flex-shrink: 0; height: 36px; font-size: 15px; }
  .toc {
    flex: 1 1 auto; min-width: 0; flex-direction: row; gap: 18px;
    white-space: nowrap; font-size: 15px;
    overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain;
    padding: 6px var(--pad-x) 6px 14px; margin-left: -14px;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 28px), transparent);
            mask-image: linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 28px), transparent);
  }
  .toc::-webkit-scrollbar { display: none; }
  .toc a { flex-shrink: 0; }
  .sec { scroll-margin-top: 120px; }
  .intro-row { margin-left: 0; gap: 40px; }
  .sec-divider { margin-left: 0; }
}

/* ---------- Mobile ---------- */
@media (max-width: 720px) {
  .about { padding-bottom: 80px; }
  .toc .toc__num { display: none; }
  .sec { padding: 48px 0 56px; }
  .sec__mark { top: 28px; left: -4px; }
  .sec > .sec__mark + *, .sec > .sec__mark + .cols, .sec--intro .sec__mark + * { margin-top: 64px; }
  /* two-line titles ("career / goals"…): start the content below the second line,
     so solid rows (stacked lists) never cover the title */
  .sec:not(.sec--intro):has(> .sec__mark br) > .sec__mark + * { margin-top: calc(clamp(64px, 11.5vw, 168px) * .86 * 2 - 4px); }
  /* Intro: big "about / me" mark on the left, avatar overlapping it on the right,
     avatar bottom aligned with the bottom of "me" */
  .sec--intro { --mark: 20.5vw; }
  .page-about:not(.page-project) .sec--intro .sec__mark br { display: none; } /* "/about me" on one line */
  .sec--intro .sec__mark { font-size: var(--mark); top: 28px; left: -2px; }
  .sec--intro .sec__mark + * { margin-top: calc(var(--mark) * 0.86 + 20px); }
  .intro-row { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .intro-row__text { gap: 16px; }
  .intro-row__hi { font-size: 22px; }
  .intro-row__media { justify-self: stretch; max-width: none; }

  .jobs { gap: 26px; }
  .job { grid-template-columns: minmax(0, 1fr); row-gap: 4px; }
  .job__company { font-size: 18px; }
  .job__role { font-size: 16px; text-align: left; grid-row: 2; }
  .job__date { font-size: 14px; }

  .cols { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .col h3 { font-size: 20px; }
  .col p { margin-top: 8px; font-size: 15px; }

  .story { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .story__visual { height: 300px; max-width: 360px; width: 100%; }
  .story__photo { width: 210px; height: 204px; right: 8px; }
  .story__note { width: 180px; min-height: 180px; top: 70px; font-size: 12px; }

  .refs { grid-template-columns: minmax(0, 1fr); }
}

/* mobile: compact cards so both fit one screen */
@media (max-width: 720px) {
  .refs { gap: 14px; }
  .ref__head { gap: 12px; }
  .ref__head > img { width: 60px; height: 60px; border-radius: 14px; }
  .ref__body { padding: 12px; gap: 14px; }
  .ref__quote { font-size: 14px; line-height: 1.5; }
  .ref__name { font-size: 18px; }
  .ref__role { font-size: 13px; }
}

/* ---------- Back to top (sub-pages) ---------- */
.to-top {
  position: fixed; z-index: 20;
  right: max(24px, env(safe-area-inset-right)); bottom: max(24px, env(safe-area-inset-bottom));
  width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface); color: var(--black); border: 1px solid var(--border);
  box-shadow: 0 8px 22px -14px var(--shadow);
  cursor: pointer;
  opacity: 0; visibility: hidden; translate: 0 8px;
  transition: opacity .35s ease, translate .35s ease, visibility 0s linear .35s, background-color .3s ease, color .3s ease, border-color .3s ease;
}
.to-top.is-visible { opacity: 1; visibility: visible; translate: 0 0; transition: opacity .35s ease, translate .35s ease, visibility 0s, background-color .3s ease, color .3s ease, border-color .3s ease; }
.to-top:hover { background: var(--btn-hover-bg); border-color: var(--btn-hover-bg); color: var(--btn-hover-fg); }
.to-top:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
@media (max-width: 720px) {
  .to-top { right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); width: 44px; height: 44px; }
}
@media (prefers-reduced-motion: reduce) { .to-top { transition: none; translate: none; } }

/* ---------- Scroll progress (same component as the home page) ---------- */
/* Overlaps the top of the content column; hidden at 0%, takes no layout space. */
/* explicit placement so the overlapping bar never pushes content into a new row */
.about__side { grid-column: 1; grid-row: 1; }
.about__content { grid-column: 2; grid-row: 1; }
.progress--page { grid-column: 2; grid-row: 1; align-self: start; margin: 0; }
.page-project .progress--page { grid-row: 1 / span 2; }
@media (max-width: 1100px) {
  /* sits just under the sticky Back + menu bar */
  .about__side { grid-column: 1; grid-row: 1; }
  .about__content { grid-column: 1; grid-row: 2; }
  .progress--page { grid-column: 1; grid-row: 2; top: 120px; }
  .page-project .progress--page { grid-row: 2 / span 2; }
}

/* ---------- Vertical section titles (About page, ≥721px) ----------
   "/experience" style: reads bottom-to-top, sits in the gutter left of the
   content, bottom-aligned with its section. Each section fills one viewport. */
@media (min-width: 721px) {
  .page-about .sec {
    --vt: clamp(72px, calc((100svh - 64px - 100px) / 5.2), 150px);
    min-height: calc(100svh - 64px); box-sizing: border-box;
    display: flex; flex-direction: column; justify-content: center;
    padding: 40px 0;
  }
  /* keep the longest section (core value) inside one screen */
  .page-about:not(.page-project) #core-value .stack { margin-top: 28px; }
  .page-about:not(.page-project) #core-value .lead--body { margin-top: 20px; }
  .page-about:not(.page-project) #core-value .story { margin-top: 24px; }
  .page-about .sec__mark {
    top: auto; right: auto; bottom: 40px;
    left: calc(-400px - 60px); /* under the sidebar menu, aligned with Back */
    writing-mode: vertical-rl; transform: rotate(180deg);
    font-size: var(--vt); line-height: .8; letter-spacing: -0.05em;
    color: var(--vmark-color);
  }
  .page-about .sec > .sec__mark + *,
  .page-about .sec > .sec__mark + .cols,
  .page-about .sec--intro .sec__mark + * { margin-top: 0; }
  /* the avatar no longer reaches into the gutter (the title lives there now) */
  .page-about .intro-row { margin-left: 0; }
}
/* Tablet: single column — make room on the left for the title */
@media (min-width: 721px) and (max-width: 1100px) {
  .page-about .sec { --vt: clamp(56px, calc((100svh - 120px - 100px) / 5.2), 104px); min-height: calc(100svh - 120px); padding-left: calc(var(--vt) + 32px); }
  .page-about .sec__mark { right: auto; left: 0; }
  /* two-word titles keep two columns here too: make room for both */
  .page-about .sec:has(> .sec__mark br) { padding-left: calc(var(--vt) * 1.7 + 32px); }
}
@media (min-width: 721px) and (max-height: 860px) {
  .page-about .story__visual { height: 236px; }
  .page-about .story__photo { width: 216px; height: 210px; }
  .page-about .story__note { top: 24px; width: 196px; min-height: 196px; }
}

/* Stacked feature rows (project "highlight features", About "career goals") — like the reference "services" list: each feature is a
   row (text | image) on the page background with a hairline under it. Every
   row sticks at the same spot, so the next one slides up and covers it. */
.stack { display: flex; flex-direction: column; }
.stack__card {
  --top: calc(64px + 24px);
  position: sticky; top: var(--top); z-index: 1;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto 1fr; gap: 28px 48px;
  padding: 24px 0 40px; box-sizing: border-box; align-content: start;
  background: var(--bg);
}
/* "01 ————" divider + number at the top of each feature */
.feature .feature__index {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 20px;
  font-size: 14px; font-weight: 500; line-height: 1; letter-spacing: .02em; color: var(--grey-1);
}
.feature__index::after { content: ""; flex: 1 1 auto; height: 1px; background: var(--grey-1); opacity: .3; }
.stack__card + .stack__card { margin-top: 40px; }
/* rows taller than the space under the header just scroll normally */
.stack__card.is-free { position: relative; top: auto; }

.feature__text { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.feature h3 { font-size: clamp(26px, 2.6vw, 40px); font-weight: 400; line-height: 1.15; letter-spacing: -0.03em; color: var(--black); }
.feature p { font-size: 16px; font-weight: 300; line-height: 1.5; color: var(--text); }
.feature__line + .feature__line { margin-top: -6px; }
.feature--compare .feature__line:first-child { margin-top: 0; }

.feature__media { min-width: 0; display: flex; flex-direction: column; }
.feature__media img { display: block; border-radius: 8px; background: var(--media-bg); }
.feature__media > img { width: 100%; height: auto; max-height: calc(100svh - var(--top) - 120px); object-fit: contain; object-position: left top; background: none; }
.feature__media--pair { gap: 14px; }
.feature__media--pair figure { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.feature__media--pair figcaption { font-size: 12px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--grey-1); }
.feature__media--pair img { width: 100%; height: auto; max-height: calc((100svh - var(--top) - 180px) / 2); object-fit: contain; object-position: left top; background: none; }

/* plain list (About page): same rows, no sticking / overlapping on scroll */
.stack--static .stack__card { position: relative; top: auto; z-index: auto; }
.stack--static .stack__card + .stack__card { margin-top: 8px; }

/* text-only rows (About career goals): title left, description right */
.feature--text { grid-template-rows: auto auto; }
.feature--text h3 { align-self: start; }

/* tablet + mobile: rows stick below the horizontal menu bar (ends at 120px) */
@media (max-width: 1100px) {
  .stack__card { --top: calc(120px + 48px); gap: 32px; }
}

@media (max-width: 720px) {
  .feature p { font-size: 15px; }
  .stack__card { --top: calc(120px + 44px); grid-template-columns: minmax(0, 1fr); grid-template-rows: none; gap: 20px; padding: 20px 0 28px; }
  .stack__card + .stack__card { margin-top: 24px; }
  .feature h3 { font-size: 26px; }
  .feature__media > img, .feature__media--pair img { max-height: none; }
}

/* ---------- FAQ (accordion) ---------- */
.faq__title { font-size: clamp(28px, 3.2vw, 48px); font-weight: 400; line-height: 1.1; letter-spacing: -0.035em; color: var(--black); }
.faq { margin-top: 48px; }
.faq__item { border-bottom: 1px solid color-mix(in srgb, var(--grey-1) 30%, transparent); }
.faq__q { margin: 0; }
.faq__q button {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 26px 0; background: none; border: 0; text-align: left; cursor: pointer;
  font: inherit; font-size: 16px; font-weight: 500; line-height: 1.35; letter-spacing: .01em; text-transform: uppercase; color: var(--black);
}
.faq__q button:focus-visible { outline: 2px solid var(--black); outline-offset: 4px; border-radius: 4px; }
.faq__dot { flex: none; width: 12px; height: 12px; border-radius: 50%; background: color-mix(in srgb, var(--grey-1) 25%, transparent); transition: background-color .3s ease, transform .3s ease; }
.faq__q button:hover .faq__dot { transform: scale(1.25); }
.faq__item.is-open .faq__dot { background: var(--black); }
/* answer panel: animates its height open / closed */
.faq__a { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .45s cubic-bezier(.16, 1, .3, 1); }
.faq__item.is-open .faq__a { grid-template-rows: 1fr; }
/* closed answers are hidden from screen readers too (after the closing animation) */
.faq__item:not(.is-open) .faq__inner { visibility: hidden; transition: visibility 0s .45s; }
.faq__inner { min-height: 0; overflow: hidden; display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; }
.faq__inner p { max-width: 640px; padding-bottom: 32px; font-size: 16px; font-weight: 300; line-height: 1.6; color: var(--text); }
.faq__num {
  flex: none; margin-bottom: 20px; font-size: clamp(64px, 7vw, 112px); font-weight: 600; line-height: .8; letter-spacing: -0.05em;
  color: var(--vmark-color); opacity: 0; transform: translateY(12px); transition: opacity .4s ease, transform .5s cubic-bezier(.16, 1, .3, 1);
}
.faq__item.is-open .faq__num { opacity: 1; transform: none; }

.faq__cta { margin-top: 64px; display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; }
.faq__cta-title { font-size: clamp(28px, 3.2vw, 48px); font-weight: 400; line-height: 1.1; letter-spacing: -0.035em; color: var(--black); }
.faq__cta-text p:not(.faq__cta-title) { margin-top: 20px; max-width: 440px; font-size: 16px; font-weight: 300; line-height: 1.6; color: var(--text); }
/* "Get in touch" + socials (same block as the home page), bottom-aligned with the text */
.faq__contact { flex: none; }

@media (max-width: 720px) {
  .faq { margin-top: 32px; }
  .faq__q button { padding: 20px 0; font-size: 14px; }
  .faq__inner p { padding-bottom: 24px; font-size: 15px; }
  .faq__num { display: none; }
  .faq__cta { flex-direction: column; align-items: flex-start; gap: 28px; margin-top: 48px; }
}
@media (prefers-reduced-motion: reduce) {
  .faq__a, .faq__num, .faq__dot { transition: none; }
}
