/* ============================================================
   page.css — shared document system for the portal's sub-pages
   (CV, digital, physical, writing). Inherits ground + typeface
   from the portal via localStorage; same warm paper + Public Sans.
   ============================================================ */
:root { --ease: cubic-bezier(0.22, 1, 0.36, 1); }

html[data-type="grotesk"] { --ff: 'Public Sans', system-ui, -apple-system, sans-serif; --ff-w: 400; --ff-wb: 700; }
html[data-type="courier"] { --ff: 'Courier Prime', ui-monospace, Menlo, monospace;     --ff-w: 400; --ff-wb: 700; }
html[data-type="plex"]    { --ff: 'IBM Plex Mono', ui-monospace, Menlo, monospace;      --ff-w: 400; --ff-wb: 600; }

html[data-ground="black"] { --bg: #0a0a0a; --fg: #ece9e1; --dim: #797568; --hair: rgba(236,233,225,0.16); --faint: rgba(236,233,225,0.06); }
html[data-ground="white"] { --bg: #faf8f2; --fg: #16140f; --dim: #847f73; --hair: rgba(22,20,15,0.16); --faint: rgba(22,20,15,0.04); }

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body {
  font-family: var(--ff);
  font-weight: var(--ff-w);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }

.sheet {
  max-width: 880px;
  margin: 0 auto;
  padding: clamp(40px, 7vh, 88px) clamp(28px, 6vw, 80px) clamp(60px, 10vh, 120px);
}

/* ── Masthead ─────────────────────────────────────────── */
.top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: clamp(36px, 6vh, 64px);
}
.back {
  font-size: 12px; letter-spacing: 0.16em; text-transform: lowercase;
  color: var(--dim); transition: color 160ms var(--ease);
}
.back:hover { color: var(--fg); }
.place { font-size: 12px; letter-spacing: 0.14em; text-transform: lowercase; color: var(--dim); }

.name {
  font-size: clamp(34px, 5.4vw, 60px);
  font-weight: var(--ff-wb);
  letter-spacing: 0.02em;
  text-transform: lowercase;
  line-height: 1;
  margin: 0;
}
.role { margin: 14px 0 0; font-size: clamp(15px, 1.6vw, 18px); color: var(--fg); }
.eyebrow { font-size: 12px; letter-spacing: 0.22em; text-transform: lowercase; color: var(--dim); margin: 0 0 14px; font-weight: var(--ff-wb); }

.contacts { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 18px; font-size: 13px; color: var(--dim); }
.contacts a { border-bottom: 1px solid var(--hair); padding-bottom: 1px; transition: color 160ms var(--ease), border-color 160ms var(--ease); }
.contacts a:hover { color: var(--fg); border-color: var(--fg); }

.lede {
  margin: clamp(26px, 4.5vh, 46px) 0 0;
  font-size: clamp(18px, 2vw, 23px);
  line-height: 1.5;
  max-width: 46ch;
  text-wrap: pretty;
}

/* ── Sections ─────────────────────────────────────────── */
.section { margin-top: clamp(40px, 6vh, 68px); }
.section > .label {
  font-size: 11.5px; letter-spacing: 0.22em; text-transform: lowercase;
  color: var(--dim); font-weight: var(--ff-wb);
  padding-bottom: 12px; border-bottom: 1px solid var(--hair); margin-bottom: 26px;
}

/* entry: meta rail + body */
.entry { display: grid; grid-template-columns: 150px 1fr; gap: 8px 28px; padding: 4px 0 24px; }
.entry + .entry { border-top: 1px solid var(--faint); padding-top: 22px; }
.entry .meta { font-size: 12.5px; color: var(--dim); letter-spacing: 0.02em; }
.entry h3 { margin: 0; font-size: 17px; font-weight: var(--ff-wb); letter-spacing: 0.01em; }
.entry .org { margin: 2px 0 0; font-size: 14px; color: var(--fg); }
.entry p { margin: 10px 0 0; color: var(--fg); max-width: 60ch; text-wrap: pretty; }
.entry ul { margin: 10px 0 0; padding-left: 18px; color: var(--fg); max-width: 60ch; }
.entry li { margin: 4px 0; }
.entry .tag { color: var(--dim); font-size: 13px; }

/* ── Products (digital) ───────────────────────────────── */
.products { display: flex; flex-direction: column; }
.product {
  display: grid; grid-template-columns: 1fr auto; gap: 8px 18px;
  padding: 22px 0; border-top: 1px solid var(--faint); align-items: baseline;
  transition: padding-left 200ms var(--ease);
}
.product:first-child { border-top: none; }
a.product:hover { padding-left: 10px; }
.phead { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.pname { font-size: clamp(19px, 2.2vw, 24px); font-weight: var(--ff-wb); letter-spacing: 0.01em; }
.purl { font-size: 13px; color: var(--dim); }
.pstatus { font-size: 12px; letter-spacing: 0.06em; text-transform: lowercase; color: var(--dim); }
.pstatus.live { color: var(--fg); }
.pdesc { grid-column: 1 / -1; margin: 6px 0 0; color: var(--fg); max-width: 64ch; text-wrap: pretty; }
.parrow { color: var(--dim); font-size: 18px; align-self: center; transition: transform 200ms var(--ease); }
a.product:hover .parrow { transform: translateX(4px); color: var(--fg); }

/* ── Stats row (physical) ─────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; margin-top: clamp(36px, 5vh, 56px); padding: 22px 0; border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair); }
.stats b { display: block; font-size: clamp(24px, 3vw, 34px); font-weight: var(--ff-wb); line-height: 1.1; letter-spacing: 0.01em; white-space: nowrap; }
.stats span { display: block; margin-top: 6px; font-size: 12.5px; color: var(--dim); line-height: 1.45; }

/* ── Device gallery (physical) ────────────────────────── */
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.gallery a { display: block; }
.gallery img { width: 100%; aspect-ratio: 4 / 3; display: block; object-fit: cover; background: #fff; border: 1px solid var(--faint); transition: opacity 160ms var(--ease); }
.gallery img.render { object-fit: contain; padding: 6px; }
.gallery a:hover img { opacity: 0.86; }

/* ── Placeholder pill ─────────────────────────────────── */
.ph {
  display: inline-block; color: var(--dim); background: var(--faint);
  border: 1px dashed var(--hair); border-radius: 2px; padding: 0 7px;
  font-size: 12px; letter-spacing: 0.04em;
}

/* ── Prose ────────────────────────────────────────────── */
.prose { max-width: 62ch; }
.prose p { margin: 0 0 16px; text-wrap: pretty; }
.biglink {
  display: inline-flex; align-items: baseline; gap: 8px; margin-top: 8px;
  font-size: clamp(17px, 1.9vw, 21px); font-weight: var(--ff-wb);
  border-bottom: 1px solid var(--fg); padding-bottom: 2px;
}
.biglink .ar { color: var(--dim); transition: transform 180ms var(--ease); }
.biglink:hover .ar { transform: translate(3px, -3px); }

.colophon {
  margin-top: clamp(48px, 8vh, 90px); padding-top: 18px; border-top: 1px solid var(--hair);
  font-size: 12px; color: var(--dim); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px;
}

@media (max-width: 600px) {
  .entry { grid-template-columns: 1fr; gap: 4px; }
  .entry .meta { order: 2; margin-top: 4px; }
  .gallery { grid-template-columns: repeat(2, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .top { flex-direction: column; gap: 6px; }
}

@media print {
  @page { margin: 16mm; }
  html, body { background: #fff; color: #111; }
  .back { display: none; }
  .section, .entry, .product { break-inside: avoid; }
}

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

/* ── Hobbies list ─────────────────────────────────────── */
.hobbies { list-style: none; margin: 0; padding: 0; counter-reset: h; }
.hobbies li {
  counter-increment: h;
  display: grid; grid-template-columns: 56px 1fr; align-items: baseline;
  padding: 14px 0; border-top: 1px solid var(--faint);
  font-size: clamp(20px, 2.6vw, 30px); font-weight: var(--ff-wb); letter-spacing: 0.01em; line-height: 1.2;
}
.hobbies li:first-child { border-top: none; }
.hobbies li::before { content: counter(h, decimal-leading-zero); font-size: 12px; font-weight: var(--ff-w); letter-spacing: 0.1em; color: var(--dim); }
.tally { margin-top: 28px; font-size: 15px; color: var(--dim); }
.tally a { color: var(--fg); border-bottom: 1px solid var(--hair); }
.tally a:hover { border-color: var(--fg); }
