/* Main site (home.html) */

/* arriving from the landing page: the orange screen shrinks away */
.arrive-cover { display: none; }
.arriving .arrive-cover { display: block; position: fixed; inset: 0; z-index: 70; pointer-events: none; background: var(--accent);
  animation: coverOut 1s cubic-bezier(.7, 0, .2, 1) .1s forwards; }
@keyframes coverOut { from { clip-path: circle(150% at 50% 50%); } to { clip-path: circle(0% at 50% 50%); } }
.arriving:not(.arrived) .hero, .arriving:not(.arrived) .hero * { animation-play-state: paused !important; }

/* scroll progress */
.progress { position: fixed; top: env(safe-area-inset-top); left: 0; right: 0; height: 2px; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); z-index: 30; }

/* nav */
/* the page runs under the iPhone status bar (viewport-fit=cover), so the nav pads down past it and its
   background fills that strip, instead of the page showing through above the nav */
nav { position: fixed; top: 0; left: 0; right: 0; z-index: 20; padding-top: env(safe-area-inset-top); transition: transform .4s var(--ease), background .3s; }
nav.scrolled { background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
nav.hide { transform: translateY(-100%); }
nav .wrap { display: flex; justify-content: space-between; align-items: center; height: 64px; }
.logo { font: 500 14px var(--mono); letter-spacing: .08em; text-decoration: none; }
.logo span { color: var(--accent); }
nav ul { display: flex; gap: 28px; list-style: none; font-size: 14px; align-items: center; }
nav ul a { text-decoration: none; color: var(--muted); position: relative; }
nav ul a::after { content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 1px; background: var(--accent); transform: scaleX(0); transform-origin: right; transition: transform .35s var(--ease); }
nav ul a:hover { color: var(--ink); }
nav ul a:hover::after { transform: scaleX(1); transform-origin: left; }

/* hero */
.hero { min-height: 100vh; padding: calc(128px + env(safe-area-inset-top)) 0 64px; display: flex; flex-direction: column; justify-content: center; }
.hero-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 48px; align-items: center; }
.eyebrow { font: 500 12px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 12px; }
.eyebrow::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
/* headline scales with its column (cqi) so each sentence stays on one line */
.hero-grid > :first-child { container-type: inline-size; }
h1 { font: 300 clamp(30px, 12cqi, 112px)/1 var(--serif); letter-spacing: -0.035em; margin: 28px 0 32px; }
h1 .line { display: block; overflow: hidden; padding-bottom: .06em; }
h1 .line > span { display: inline-block; white-space: nowrap; animation: rise 1.1s var(--ease) both; }
h1 .line:nth-child(2) > span { animation-delay: .12s; }
.rot { font-style: italic; color: var(--accent); display: inline-block; transition: transform .4s var(--ease), opacity .4s; }
.rot.alt { color: color-mix(in srgb, var(--accent) 45%, var(--muted)); }
.rot.out { transform: translateY(-45%); opacity: 0; }
.rot.enter { transform: translateY(45%); opacity: 0; transition: none; }
.lede { max-width: 580px; font-size: 19px; color: var(--muted); }
.lede strong { color: var(--ink); font-weight: 500; }
.ctas { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }
.btn { display: inline-flex; align-items: center; gap: 10px; padding: 14px 22px; border-radius: 999px; font: 500 14px var(--sans); text-decoration: none; border: 1px solid var(--ink); transition: background .3s, color .3s, transform .3s var(--ease); }
.btn.solid { background: var(--ink); color: var(--bg); }
.btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.scroll-hint { margin-top: 64px; font: 400 12px var(--mono); color: var(--muted); letter-spacing: .1em; display: flex; align-items: center; gap: 14px; }
.scroll-hint i { width: 64px; height: 1px; background: var(--line); position: relative; overflow: hidden; }
.scroll-hint i::after { content: ""; position: absolute; inset: 0; background: var(--accent); animation: scan 2s var(--ease) infinite; }
@keyframes scan { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* portrait: cut-out photo in front of the orange dot, fading into the page at the bottom */
.portrait { width: 100%; max-width: 460px; margin: 0; justify-self: end; }
.portrait-art { position: relative; mask-image: linear-gradient(to bottom, #000 72%, transparent 98%); }
.portrait-art::before { content: ""; position: absolute; left: 10%; top: 9%; width: 88%; aspect-ratio: 1; border-radius: 50%; border: 1px solid var(--line); }
.portrait-dot { position: absolute; left: 4%; top: 14%; width: 88%; aspect-ratio: 1; border-radius: 50%; background: var(--accent);
  animation: dotIn 1.2s var(--ease) .5s both; transition: transform .8s var(--ease); }
.portrait img { position: relative; display: block; width: 100%; height: auto;
  animation: portraitIn 1.2s var(--ease) .65s both; transition: transform .8s var(--ease); }
.portrait figcaption { position: relative; margin-top: -24px; padding-top: 14px; border-top: 1px solid var(--line); font: 400 11px var(--mono); letter-spacing: .1em; color: var(--muted); display: flex; justify-content: space-between; }
@keyframes dotIn { from { scale: 0; } }
@keyframes portraitIn { from { opacity: 0; translate: 0 48px; } }

/* image placeholder: drop real files into /images and they replace the gradient */
.ph { position: relative; overflow: hidden; background: var(--g); }
.ph img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; user-select: none; }

/* marquee band */
.band { overflow: hidden; padding: 56px 0; }
.band-inner { transform: rotate(-2deg); margin: 0 -40px; }
.m1 { background: var(--ink); color: var(--bg); font: 300 clamp(32px, 5vw, 64px)/1 var(--serif); }
.m1 span:nth-child(even) { font-style: italic; }
.m2 { background: var(--accent); color: #fff; font: 500 clamp(14px, 1.6vw, 18px)/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; transform: rotate(3deg); margin-top: -8px; }
.m2 .star { color: var(--ink); }

/* sections */
section { padding: 104px 0; }
.sec-head { display: grid; grid-template-columns: 220px 1fr; gap: 40px; margin-bottom: 56px; align-items: baseline; }
.sec-num { font: 500 13px var(--mono); color: var(--accent); letter-spacing: .1em; }
h2 { font: 300 clamp(34px, 5vw, 60px)/1.05 var(--serif); letter-spacing: -0.025em; }
h2 em { color: var(--accent); }
.body { margin-left: 260px; }

/* reveal on scroll */
.js .reveal { opacity: 0; transform: translateY(28px); transition: opacity 1s var(--ease), transform 1s var(--ease); transition-delay: var(--d, 0s); }
.js .reveal.shown { opacity: 1; transform: none; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 56px; }
.stat { padding: 28px 0 24px; }
.stat + .stat { padding-left: 24px; border-left: 1px solid var(--line); }
.stat b { display: block; font: 300 clamp(44px, 6vw, 76px)/1 var(--serif); letter-spacing: -0.03em; }
.stat b sup { font-size: .45em; color: var(--accent); vertical-align: top; }
.stat small { font: 400 12px var(--mono); color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }

/* experience */
.job { position: relative; isolation: isolate; display: grid; grid-template-columns: 200px 1fr 24px; gap: 40px; padding: 30px 16px; margin: 0 -16px; border-bottom: 1px solid var(--line); }
.job::before { content: ""; position: absolute; inset: 0; background: var(--surface); transform: scaleY(0); transform-origin: bottom; transition: transform .5s var(--ease); z-index: -1; }
.job:hover::before { transform: scaleY(1); }
.job:has(.plus) { cursor: pointer; }
.job .plus { align-self: start; padding: 0; border: 0; background: none; cursor: pointer; font: 300 24px/1 var(--serif); color: var(--accent); transition: transform .4s var(--ease); }
.job:hover .plus { transform: rotate(90deg); }
.job.open .plus { transform: rotate(45deg); }

/* key achievements: folded away until the + is pressed (left open when scripts don't run) */
.wins { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .5s var(--ease); }
.wins ul { min-height: 0; overflow: hidden; list-style: none; max-width: 600px; transition: visibility 0s; }
.js .job:not(.open) .wins { grid-template-rows: 0fr; }
.js .job:not(.open) .wins ul { visibility: hidden; transition-delay: .5s; }
.wins li { padding: 12px 0; border-top: 1px solid var(--line); font-size: 15px; color: var(--muted); }
.wins li:first-child { margin-top: 18px; }
.wins li b { display: block; font: 500 12px var(--mono); color: var(--accent); letter-spacing: .08em; text-transform: uppercase; margin-bottom: 4px; }
.when { font: 400 13px/1.9 var(--mono); color: var(--muted); }
.job h3 { font: 500 21px var(--sans); }
.job .co { color: var(--muted); }
.job p { margin-top: 8px; color: var(--muted); max-width: 600px; }
.todo { background: repeating-linear-gradient(-45deg, transparent 0 6px, color-mix(in srgb, var(--accent) 14%, transparent) 6px 12px); border-radius: 3px; padding: 0 4px; }

.skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); margin-top: 56px; }
.skills div { background: var(--bg); padding: 22px; transition: background .3s, color .3s; }
.skills div:hover { background: var(--ink); color: var(--bg); }
.skills b { display: block; font: 500 12px var(--mono); color: var(--accent); letter-spacing: .08em; margin-bottom: 6px; }

/* writing */
.post { display: grid; grid-template-columns: 60px 140px 1fr auto; gap: 24px; align-items: center; padding: 26px 0; border-bottom: 1px solid var(--line); text-decoration: none; transition: padding .4s var(--ease), color .3s; }
.post:hover { padding-left: 16px; color: var(--accent); }
.post .n { font: 400 13px var(--mono); color: var(--accent); }
.post h3 { font: 400 clamp(22px, 2.4vw, 28px)/1.25 var(--serif); }
.post .arrow { font-family: var(--mono); transition: transform .4s var(--ease); }
.post:hover .arrow { transform: translate(4px, -4px); }

/* horizontal gallery */
.hs { position: relative; padding: 0; background: var(--ink); color: var(--bg); }
.hs-sticky { position: sticky; top: 0; height: 100vh; overflow: hidden; display: flex; flex-direction: column; justify-content: center; }
.hs-track { display: flex; gap: 28px; padding: 0 6vw; align-items: flex-end; will-change: transform; }
.hs-intro { flex: none; width: min(440px, 80vw); align-self: center; padding-right: 40px; }
.hs-intro .sec-num { display: block; margin-bottom: 20px; }
.hs-intro p { color: color-mix(in srgb, var(--bg) 60%, transparent); margin-top: 20px; }
.hs-item { flex: none; cursor: zoom-in; }
.hs-item .ph { height: var(--h, 62vh); aspect-ratio: var(--r); border-radius: 3px; }
.hs-item .ph img { transition: transform 1.2s var(--ease); }
.hs-item:hover .ph img { transform: scale(1.05); }
.hs-item figcaption { margin-top: 12px; font: 400 12px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: color-mix(in srgb, var(--bg) 60%, transparent); display: flex; gap: 14px; }
.hs-item figcaption b { color: var(--accent); font-weight: 400; }
.hs-meta { position: absolute; left: 6vw; right: 6vw; bottom: 32px; display: flex; align-items: center; gap: 20px; font: 400 12px var(--mono); color: color-mix(in srgb, var(--bg) 55%, transparent); }
.hs-bar { flex: 1; height: 1px; background: color-mix(in srgb, var(--bg) 20%, transparent); position: relative; }
.hs-bar i { position: absolute; inset: 0; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); }
.hs:not(.pinned) .hs-sticky { position: static; height: auto; padding: 88px 0; }
.hs:not(.pinned) .hs-track { overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: 6vw; padding-bottom: 24px; align-items: flex-start; }
/* the intro is a snap point too, so the strip opens on the text rather than jumping to the first image */
.hs:not(.pinned) .hs-intro { scroll-snap-align: start; align-self: flex-start; }
.hs:not(.pinned) .hs-item { scroll-snap-align: center; }
.hs:not(.pinned) .hs-item .ph { --h: min(62vh, 420px); }
.hs:not(.pinned) .hs-meta { display: none; }

/* not ready yet (.soon): no pinned scroll (the strip only strains a few px, see home.js), three blank
   frames that slowly develop like prints in a darkroom, taped off with the landing page's construction tape */
.hs.soon .hs-track { overflow-x: clip; }
.hs.soon .hs-item { cursor: default; }
.hs.soon .hs-item:nth-of-type(n+4) { display: none; }
.hs.soon .hs-item .ph { height: 300px; aspect-ratio: 4/5; animation: develop 4s ease-in-out infinite alternate; }
.hs.soon .hs-item:nth-of-type(2) .ph { animation-delay: -1.3s; }
.hs.soon .hs-item:nth-of-type(3) .ph { animation-delay: -2.6s; }
@keyframes develop { from { filter: grayscale(1) brightness(.45); } }
.hs.soon .hs-item:nth-of-type(2) { position: relative; z-index: 1; }
.hs.soon .hs-item:nth-of-type(2)::before, .hs.soon .hs-item:nth-of-type(2)::after {
  content: "UNDER CONSTRUCTION ✦ UNDER CONSTRUCTION ✦ UNDER CONSTRUCTION ✦ UNDER CONSTRUCTION ✦ UNDER CONSTRUCTION ✦ UNDER CONSTRUCTION ✦ UNDER CONSTRUCTION ✦ UNDER CONSTRUCTION ✦ UNDER CONSTRUCTION ✦ UNDER CONSTRUCTION ✦ UNDER CONSTRUCTION ✦ UNDER CONSTRUCTION ✦ UNDER CONSTRUCTION ✦ UNDER CONSTRUCTION ✦ UNDER CONSTRUCTION ✦ UNDER CONSTRUCTION ✦ UNDER CONSTRUCTION ✦ UNDER CONSTRUCTION ✦ UNDER CONSTRUCTION ✦ UNDER CONSTRUCTION ✦ UNDER CONSTRUCTION ✦ UNDER CONSTRUCTION ✦ UNDER CONSTRUCTION ✦ UNDER CONSTRUCTION ✦";
  /* hung off the middle frame, starting just left of the first one and running off the right edge */
  position: absolute; left: calc(-100% - 60px); top: 34%; width: 100vw; translate: 0 -50%; transform-origin: 0 50%; rotate: 4deg;
  padding: 15px 0; overflow: hidden; white-space: nowrap; text-align: center;
  font: 500 clamp(11px, 1.2vw, 14px)/1 var(--mono); letter-spacing: .14em; color: var(--bg);
  background:
    repeating-linear-gradient(-45deg, var(--bg) 0 8px, transparent 8px 16px) top / 100% 6px no-repeat,
    repeating-linear-gradient(-45deg, var(--bg) 0 8px, transparent 8px 16px) bottom / 100% 6px no-repeat,
    var(--accent);
  box-shadow: 0 12px 30px #0005;
}
.hs.soon .hs-item:nth-of-type(2)::after { top: 62%; rotate: -4deg; }

dialog { margin: auto; border: 0; padding: 0; background: none; max-width: 92vw; max-height: 90vh; }
dialog::backdrop { background: rgba(10,10,9,.88); backdrop-filter: blur(6px); }
dialog .ph { height: min(80vh, 900px); aspect-ratio: var(--r); max-width: 92vw; border-radius: 3px; }
dialog[open] { animation: zoomIn .5s var(--ease); }
@keyframes zoomIn { from { opacity: 0; transform: scale(.94); } }
dialog .close { position: fixed; top: calc(20px + env(safe-area-inset-top)); right: calc(24px + env(safe-area-inset-right)); font: 500 13px var(--mono); color: #fff; background: none; border: 1px solid #fff6; border-radius: 999px; padding: 8px 16px; cursor: pointer; }

/* misc */
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; }
.grid3 h4 { font: 500 12px var(--mono); color: var(--muted); letter-spacing: .12em; text-transform: uppercase; margin-bottom: 16px; }
.grid3 ul { list-style: none; }
.grid3 li { padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 15px; transition: padding .3s var(--ease); }
.grid3 li:hover { padding-left: 8px; }
.grid3 li small { display: block; color: var(--muted); font-size: 13px; }

/* contact */
.contact { padding: 160px 0 120px; border-top: 1px solid var(--line); }
.contact h2 { font-size: clamp(64px, 14vw, 200px); line-height: .95; letter-spacing: -0.045em; margin-top: 24px; }
.contact h2 a { text-decoration: none; }
.contact h2 a .char { font-style: italic; color: var(--accent); }
.js .split .char { opacity: 0; transform: translateY(.4em); }
.js .split.shown .char { opacity: 1; transform: none; transition: transform .9s var(--ease), opacity .9s, color .3s; transition-delay: calc(var(--i) * 35ms); }
.js .split.shown .char:hover { transform: translateY(-.1em) rotate(-6deg); transition-delay: 0s; }
.links { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 56px; }
.links .btn { font-family: var(--mono); font-weight: 400; }

/* contact form (dialog) */
.write { width: min(560px, 92vw); overflow: auto; }
.write form { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: clamp(24px, 5vw, 44px); color: var(--ink); }
.write h3 { font: 300 clamp(34px, 5vw, 48px)/1.05 var(--serif); letter-spacing: -0.025em; margin: 10px 0 28px; }
.write h3 em { color: var(--accent); }
.write label { display: block; margin-bottom: 18px; font: 500 12px var(--mono); color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.write input, .write textarea { display: block; width: 100%; margin-top: 6px; padding: 10px 0; font: 400 17px var(--sans); color: var(--ink); background: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; resize: vertical; transition: border-color .3s; }
.write :is(input, textarea):focus { outline: none; border-bottom-color: var(--accent); }
.write .trap { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.write-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; margin-top: 28px; }
.write-foot .btn { font-family: var(--mono); font-weight: 400; cursor: pointer; }
.write-foot .btn:disabled { opacity: .5; pointer-events: none; }
.write-status { font: 400 13px var(--mono); color: var(--muted); }
.write-status.err { color: var(--accent); }
footer { padding: 32px 0; border-top: 1px solid var(--line); font: 400 12px var(--mono); color: var(--muted); }
footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

@media (max-width: 860px) {
  nav ul li:not(:last-child) { display: none; }
  .hero { padding-top: calc(104px + env(safe-area-inset-top)); }
  h1 { font-size: clamp(30px, 11.2cqi, 112px); }
  /* title, then the photo, then the intro sitting over the photo's faded-out bottom. The text column
     dissolves (display: contents) so the photo can slot in between; the grid becomes the cqi container */
  /* minmax(0, …): without it the one-line (nowrap) headline stretches the column past the screen */
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 0; container-type: inline-size; }
  /* .hero is a flex column, so its wrap shrinks to its content, which containment makes 0 wide */
  .hero .wrap { width: 100%; }
  .hero-grid > :first-child { display: contents; }
  .hero-grid .eyebrow { order: 1; }
  .hero-grid h1 { order: 2; margin: 20px 0 24px; }
  .portrait { order: 3; max-width: 340px; justify-self: center; }
  .portrait figcaption { display: none; }
  .lede { order: 4; position: relative; margin-top: calc(min(340px, 100%) * -.22); font-size: 16px; text-shadow: 0 0 10px var(--bg), 0 0 3px var(--bg); }
  .ctas { order: 5; margin-top: 28px; }
  .scroll-hint { display: none; }
  .sec-head, .job, .post { grid-template-columns: 1fr; gap: 6px; }
  .post .arrow, .post .n { display: none; }
  .job:has(.plus) { padding-right: 52px; }
  .job .plus { position: absolute; top: 30px; right: 16px; }
  .body { margin-left: 0; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(3) { padding-left: 0; border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .grid3 { grid-template-columns: 1fr; }
  section { padding: 80px 0; }
  /* too narrow for intro and frames side by side, and the strip can't scroll, so the frames drop below */
  .hs.soon .hs-track { flex-wrap: wrap; gap: 12px; }
  .hs.soon .hs-intro { width: 100%; padding: 0 0 16px; }
  .hs.soon .hs-item { width: calc((100% - 24px) / 3); }
  .hs.soon .hs-item .ph { width: 100%; height: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .js .reveal, .js .split .char { opacity: 1; transform: none; }
  .arriving .arrive-cover { display: none; }
  .hs.soon .hs-item .ph { animation: none; }
}
