/* Erg — styles */
@font-face { font-family: 'EB Garamond'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/eb-garamond-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'EB Garamond'; font-style: italic; font-weight: 400; font-display: swap; src: url(fonts/eb-garamond-latin-400-italic.woff2) format('woff2'); }
@font-face { font-family: 'EB Garamond'; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/eb-garamond-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'EB Garamond'; font-style: italic; font-weight: 500; font-display: swap; src: url(fonts/eb-garamond-latin-500-italic.woff2) format('woff2'); }
@font-face { font-family: 'EB Garamond'; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/eb-garamond-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'DM Mono'; font-style: normal; font-weight: 300; font-display: swap; src: url(fonts/dm-mono-latin-300-normal.woff2) format('woff2'); }
@font-face { font-family: 'DM Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/dm-mono-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'DM Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/dm-mono-latin-500-normal.woff2) format('woff2'); }

:root {
  --paper: #f7f5f0;
  --ink: #15140f;
  --ink-60: rgba(21, 20, 15, .6);
  --ink-40: rgba(21, 20, 15, .4);
  --ink-12: rgba(21, 20, 15, .12);
  --black: #060606;
  --bone: #efece4;
  --bone-50: rgba(239, 236, 228, .5);
  --serif: 'EB Garamond', 'Iowan Old Style', Georgia, serif;
  --mono: 'DM Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --m: clamp(16px, 2.4vw, 40px);         /* page margin */
  --fast: 220ms;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: var(--paper); color: var(--ink); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body { font-family: var(--serif); font-size: 18px; line-height: 1.4; min-height: 100vh; min-height: 100dvh; }
body[data-view="home"] { overflow: hidden; height: 100vh; height: 100dvh; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--ink); color: var(--paper); }

.mono { font-family: var(--mono); font-weight: 400; font-size: 12px; letter-spacing: .02em; }
.label { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-60); }

/* ---------- views ---------- */
.view { display: none; }
.view.is-active { display: block; }
#veil { position: fixed; inset: 0; background: var(--paper); z-index: 50; pointer-events: none; opacity: 0; transition: opacity 260ms var(--ease); }
#veil.on { opacity: 1; }

/* ---------- chrome ---------- */
#mark {
  position: absolute; top: var(--m); left: var(--m); z-index: 20;
  display: none; align-items: center; gap: 10px; cursor: pointer;
}
body:not([data-view="home"]) #mark { display: flex; }
#mark .mk { display: block; width: 96px; height: 56px; overflow: hidden; position: relative; }
#mark pre { position: absolute; left: 0; top: 0; margin: 0; font-family: var(--mono); font-weight: 500; font-size: 10px; line-height: 1; width: 192px; height: 112px; overflow: hidden; color: var(--ink); transform: scale(.5); transform-origin: 0 0; }
#navfade { position: fixed; left: 0; right: 0; bottom: 0; height: 110px; z-index: 19; pointer-events: none; background: linear-gradient(180deg, rgba(247,245,240,0), var(--paper) 70%); }
body[data-view="home"] #navfade { display: none; }


#nav {
  position: fixed; left: 0; right: 0; bottom: calc(var(--m) * .8); z-index: 20;
  display: flex; justify-content: center; gap: 36px;
  font-family: var(--mono); font-weight: 300; font-size: 13px; letter-spacing: .03em;
  mix-blend-mode: difference; color: var(--bone);
}
#nav a { position: relative; padding: 6px 2px; color: inherit; opacity: .72; transition: opacity var(--fast); }
#nav a:hover, #nav a.is-active { opacity: 1; }
#nav a.is-active::before { content: '⊙'; position: absolute; left: -18px; font-size: 13px; }

/* ---------- home ---------- */
#home { position: relative; height: 100vh; height: 100dvh; }
#logo {
  position: absolute; right: calc(var(--m) * 1.2); top: 9vh;
  width: min(46vw, 78vh); height: min(46vw, 78vh);
  margin: 0; font-family: var(--mono); font-weight: 500; color: var(--ink);
  font-size: clamp(6px, .6vw, 10px); line-height: 1; letter-spacing: 0;
  overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: none; cursor: grab;
}
#logo.grabbing { cursor: grabbing; }
#hero {
  position: absolute; left: var(--m); bottom: calc(var(--m) * 2.2); right: 50%;
  max-width: 620px;
}
#wordmark { display: flex; align-items: baseline; gap: .12em; margin: 0 0 clamp(26px, 3.2vw, 54px) -.06em; }
#wordmark b { font-family: var(--serif); font-weight: 500; font-size: clamp(112px, 15vw, 232px); line-height: .78; letter-spacing: -.035em; }
#wordmark small { font-family: var(--mono); font-weight: 300; font-size: clamp(14px, 1.3vw, 20px); letter-spacing: .04em; color: var(--ink-60); transform: translateY(-.1em); }
.entry { font-size: clamp(17px, 1.35vw, 21px); line-height: 1.42; max-width: 52ch; }
.entry .head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.entry .head b { font-weight: 500; font-size: 1.15em; }
.entry .head i { color: var(--ink-60); }
.entry .head .mono { color: var(--ink-60); }
.entry ol { list-style: none; margin: 0; padding: 0; }
.entry li { display: grid; grid-template-columns: 1.6em 1fr; gap: 0; margin: 0 0 4px; }
.entry li .n { font-family: var(--mono); font-size: 11px; color: var(--ink-60); padding-top: .45em; }
.entry li i { color: var(--ink-60); }
.entry li .plain { color: inherit; font-weight: 700; }
.entry .tag { margin-top: 22px; font-size: 1.02em; color: var(--ink); max-width: 46ch; }
.entry .tag b { font-weight: 500; color: var(--ink); }

/* ---------- inner page column ---------- */
.page { padding: max(150px, calc(var(--m) * 4.2)) var(--m) calc(var(--m) * 5); }
.col { max-width: 660px; margin: 0 auto; }
.pagehead { margin-bottom: clamp(44px, 8vh, 96px); }
.pagehead h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(36px, 5vw, 60px); line-height: 1.04; letter-spacing: -.015em; margin: 0 0 .5em; }
.pagehead p.lede { font-size: clamp(20px, 2vw, 25px); line-height: 1.35; margin: 0; color: var(--ink); }
.pagehead p.line { margin-top: 1em; }

/* ---------- thesis ---------- */
.sec { position: relative; margin: 0 0 clamp(40px, 7vh, 80px); }
.sec .num { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; color: var(--ink-60); margin-bottom: 10px; }
.sec h2 { font-family: var(--serif); font-weight: 400; font-style: italic; font-size: clamp(24px, 2.6vw, 32px); margin: 0 0 .55em; letter-spacing: -.01em; }
.sec p { font-size: clamp(18px, 1.45vw, 21px); line-height: 1.5; margin: 0 0 1em; }
.sec p:last-child { margin-bottom: 0; }
@media (min-width: 1000px) {
  .sec .num { position: absolute; left: -120px; top: 14px; width: 90px; text-align: right; }
}
.fig-term { border-bottom: 1px dotted var(--ink-40); cursor: crosshair; padding-bottom: 1px; transition: border-color var(--fast), color var(--fast); }
.fig-term:hover, .fig-term.is-on { border-bottom-style: solid; border-color: var(--ink); }
.src { border-bottom: 1px solid var(--ink-12); white-space: nowrap; transition: border-color var(--fast); }
.src:hover { border-color: var(--ink); }
.src sup { font-family: var(--mono); font-size: .6em; margin-left: .15em; color: var(--ink-60); vertical-align: .55em; }
.colophon { margin-top: clamp(56px, 10vh, 120px); padding-top: 24px; border-top: 1px solid var(--ink-12); display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; font-family: var(--mono); font-size: 12px; color: var(--ink-60); }
.colophon a { border-bottom: 1px solid transparent; } .colophon a:hover { border-color: var(--ink-60); }
.closing { margin-top: clamp(48px, 9vh, 110px); font-size: clamp(26px, 3.2vw, 44px); line-height: 1.15; font-style: italic; letter-spacing: -.01em; }
.closing b { font-style: normal; font-weight: 500; }

/* ---------- figure overlay ---------- */
#fig { position: fixed; inset: 0; z-index: 40; pointer-events: none; visibility: hidden; }
#fig.is-open { visibility: visible; }
#fig.is-open.is-touch { pointer-events: auto; }
.pix { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(var(--px, 32), 1fr); grid-auto-rows: 1fr; }
.pix i { background: var(--black); opacity: 0; transition: opacity 0s linear var(--d, 0ms); }
#fig.is-open .pix i, #card.is-open .pix i { opacity: 1; }
#fig.is-closing .pix i, #card.is-closing .pix i { opacity: 0; }
#figpre { position: absolute; inset: 0; margin: 0; padding: 0; font-family: var(--mono); font-weight: 400; color: var(--bone); font-size: clamp(7px, .75vw, 13px); line-height: 1.05; overflow: hidden; opacity: 0; transition: opacity 320ms var(--ease) 260ms; user-select: none; }
#fig.is-open:not(.is-closing) #figpre { opacity: 1; }
#figcap { position: absolute; left: var(--m); right: var(--m); bottom: calc(var(--m) * .8 + 44px); display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; font-family: var(--mono); font-size: 12px; letter-spacing: .03em; color: var(--bone); opacity: 0; transition: opacity 300ms var(--ease) 420ms; }
#fig.is-open:not(.is-closing) #figcap { opacity: 1; }
#figcap .l b { font-weight: 500; margin-right: 14px; }
#figcap .l span { color: var(--bone-50); }
#figcap .r { text-align: right; color: var(--bone-50); max-width: 40ch; line-height: 1.5; }
#figcap .r b { color: var(--bone); font-weight: 400; }
#figclose { position: absolute; top: var(--m); right: var(--m); font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--bone); display: none; cursor: pointer; }
#fig.is-touch #figclose { display: block; }

/* ---------- portcos ---------- */
#portlist { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink-12); }
#portlist li { border-bottom: 1px solid var(--ink-12); }
#portlist a { display: grid; grid-template-columns: 3ch 1fr auto; align-items: baseline; gap: 20px; padding: clamp(16px, 2.6vh, 28px) 0; cursor: crosshair; transition: opacity 240ms var(--ease); }
#portlist .i { font-family: var(--mono); font-size: 11px; color: var(--ink-60); }
#portlist .n { font-family: var(--serif); font-weight: 400; font-size: clamp(30px, 4.2vw, 58px); line-height: 1; letter-spacing: -.02em; }
#portlist .n sup { font-family: var(--mono); font-size: .38em; color: var(--ink-60); margin-left: .25em; vertical-align: .9em; font-weight: 400; }
#portlist .c { font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-60); }
#portlist.is-hovering a { opacity: .28; }
#portlist.is-hovering a.is-on { opacity: 1; }
#portcos .foot { padding-top: 28px; font-family: var(--mono); font-size: 12px; color: var(--ink-60); line-height: 1.6; margin: 0; }
#portcos .foot2 { font-family: var(--serif); font-style: italic; font-size: 16px; color: var(--ink-40); margin: 6px 0 0; }
#portlist .acq { font-family: var(--mono); font-size: 11px; letter-spacing: .04em; color: var(--ink-60); margin-left: .5em; vertical-align: .35em; }

#card { position: fixed; inset: 0; z-index: 45; pointer-events: none; visibility: hidden; color: var(--bone); }
#card.is-open { visibility: visible; }
#card .content { position: absolute; inset: 0; background: var(--black); opacity: 0; transition: opacity 300ms var(--ease) 240ms; }
#card.is-open:not(.is-closing) .content { opacity: 1; }
#card.is-closing .content { transition-delay: 0ms; transition-duration: 140ms; }
#card .content.swap { opacity: .0 !important; transition: opacity 120ms var(--ease) 0ms; }
#card.is-open.is-touch { pointer-events: auto; }
#card .bg { position: absolute; inset: 0; background-size: cover; background-position: center; filter: blur(28px) brightness(.38) saturate(.9); transform: scale(1.12); }
#card .img { position: absolute; left: 0; top: 0; bottom: 0; width: 56%; background-size: cover; background-position: center; }
#card .img { -webkit-mask-image: linear-gradient(90deg, #000 55%, transparent 100%); mask-image: linear-gradient(90deg, #000 55%, transparent 100%); }
#card .fade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(6,6,6,0) 50%, rgba(6,6,6,.55) 70%, rgba(6,6,6,.82) 100%); }
#card .txt { position: absolute; right: calc(var(--m) * 1.6); top: 50%; transform: translateY(-50%); width: min(38vw, 520px); }
#card .txt .k { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--bone-50); margin-bottom: 14px; }
#card .txt h3 { font-family: var(--serif); font-weight: 400; font-size: clamp(34px, 3.6vw, 56px); line-height: 1; letter-spacing: -.02em; margin: 0 0 14px; }
#card .txt .one { font-size: clamp(18px, 1.5vw, 22px); line-height: 1.4; margin: 0 0 28px; color: var(--bone); }
#card .txt .why { font-size: clamp(16px, 1.25vw, 18px); line-height: 1.5; color: rgba(239,236,228,.78); margin: 0; }
#card .txt .site { display: inline-block; margin-top: 26px; font-family: var(--mono); font-size: 12px; letter-spacing: .04em; color: var(--bone-50); border-bottom: 1px solid rgba(239,236,228,.25); }
#card .txt .site:hover { color: var(--bone); border-color: var(--bone); }
#card .ph { position: absolute; left: 0; top: 0; bottom: 0; width: 58%; display: grid; place-items: center; font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--bone-50); }
#card .ph pre { font-size: clamp(6px, .62vw, 10px); line-height: 1.05; color: rgba(239,236,228,.78); margin: 0; width: 86%; height: 78%; overflow: hidden; }
#cardclose { position: absolute; top: var(--m); right: var(--m); font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--bone); display: none; cursor: pointer; z-index: 2; }
#card.is-touch #cardclose { display: block; }

/* ---------- small screens ---------- */
@media (max-width: 760px) {
  body[data-view="home"] { overflow: hidden; height: 100dvh; }
  #home.is-active { display: flex; }
  /* tune the phone home here: --logo-drop moves the disk down, --logo-size sets its size */
  #home { --logo-drop: clamp(4dvh, calc((100dvh - 600px) / 2.2), 16dvh); --logo-size: min(58vw, 30dvh); height: 100dvh; min-height: 0; overflow: hidden; flex-direction: column; justify-content: flex-start; padding-bottom: 0; }
  #logo { position: relative; right: auto; top: auto; flex: none; width: var(--logo-size); height: var(--logo-size); margin: var(--logo-drop) auto 0; font-size: 6px; }
  #hero { position: absolute; left: var(--m); right: var(--m); bottom: 62px; margin: 0; max-width: none; }
  body[data-view="home"] #navfade { display: block; }
  #wordmark b { font-size: min(104px, 12.5dvh); }
  #wordmark { margin-bottom: min(28px, 3dvh); }
  .entry { font-size: min(17px, 2.1dvh); }
  .entry .tag { margin-top: min(18px, 2dvh); }
  .page { padding-top: 120px; }
  #card .img { width: 100%; bottom: 46%; }
  #card .img { -webkit-mask-image: linear-gradient(180deg, #000 55%, transparent 100%); mask-image: linear-gradient(180deg, #000 55%, transparent 100%); }
  #card .ph { width: 100%; bottom: 46%; }
  #card .fade { background: linear-gradient(180deg, rgba(6,6,6,0) 40%, rgba(6,6,6,.85) 60%); }
  #card .txt { right: var(--m); left: var(--m); width: auto; top: auto; bottom: calc(var(--m) + 56px); transform: none; }
  #portlist a { grid-template-columns: 3ch 1fr; }
  #portlist .c { display: none; }
  #figcap { flex-direction: column; align-items: flex-start; }
  #figcap .r { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 1ms !important; animation-duration: 1ms !important; animation-delay: 0ms !important; }
}

/* mobile close buttons */
#figclose, #cardclose {
  top: max(var(--m), env(safe-area-inset-top)); right: var(--m);
  padding: 10px 16px 10px 14px; border: 1px solid rgba(239,236,228,.45); border-radius: 999px;
  background: rgba(6,6,6,.7); color: var(--bone); font-family: var(--mono); font-size: 13px; letter-spacing: .06em;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); z-index: 3; line-height: 1;
}
#figclose::before, #cardclose::before { content: '✕'; margin-right: 8px; font-size: 12px; }
#figclose:active, #cardclose:active { background: var(--bone); color: var(--black); }
@media (max-width: 760px) {
  #figpre { top: 64px; bottom: 170px; height: auto; }
}
