/* jenf.vercel.app
   Type from jenniferfang.com: Big Caslon for display, Space Grotesk for reading.
   One blue, International Klein #002FA7, on white. Everything else is ink on paper.
   No monospace outside code. Nothing uppercased. Nothing greyed to recede. */

:root {
  --serif: "Big Caslon", "Libre Caslon Text", "Iowan Old Style", Georgia, serif;
  --serif-italic: "Libre Caslon Text", "Big Caslon", Georgia, serif;
  --sans: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --code: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --paper: #fbfaf7;
  --ink: #121212;
  --accent: #002fa7;          /* International Klein Blue */
  --on-accent: #ffffff;
  --link: #002fa7;            /* link text, and the hairlines blue draws */
  --link-weight: 400;
  --rule: rgba(18, 18, 18, 0.14);
  --code-bg: rgba(18, 18, 18, 0.05);

  --measure: 36rem;

  /* Editable tokens. ui-agent writes these declarations back from the dev panel,
     so they stay literal values (no var() aliases) in px, rem or ms. */
  --space-row: 8px;
  --space-section: 48px;
  --space-page: 80px;
  --space-code: 16px;
  --radius-code: 2px;
  --radius-link: 1px;
  --motion-hover: 120ms;
  --type-body: 17px;
  --type-small: 14px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: rgb(135, 0, 0);
    --ink: #f4f3ef;
    --accent: #002fa7;
    --on-accent: #ffffff;
    --link: #f4f3ef;
    --link-weight: 500;
    --rule: rgba(255, 255, 255, 0.2);
    --code-bg: rgba(255, 255, 255, 0.07);
  }
}

:root[data-theme="dark"] {
  --paper: rgb(135, 0, 0);
  --ink: #f4f3ef;
  --accent: #002fa7;
  --on-accent: #ffffff;
  --link: #f4f3ef;
  --link-weight: 500;
  --rule: rgba(255, 255, 255, 0.2);
  --code-bg: rgba(255, 255, 255, 0.07);
}

* { box-sizing: border-box; }

html {
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: var(--type-body);
  line-height: 1.55;
  font-feature-settings: "tnum" 1;
}

::selection { background: var(--accent); color: var(--on-accent); }

main {
  max-width: var(--measure);
  margin: 0 auto;
  padding: var(--space-page) 1rem 4rem;
}
@media (max-width: 768px) {
  main { padding: 3rem 1.25rem 3rem; }
}

h1, h2, h3 { font-weight: 400; margin: 0; }

h1 {
  font-family: var(--serif);
  font-size: 32px;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

h2 {
  font-family: var(--serif);
  font-size: 24px;
  line-height: 1.2;
  margin-top: var(--space-section);
  margin-bottom: 0.75rem;
}

h3 {
  font-size: var(--type-body);
  font-weight: 500;
  margin-top: 2rem;
  margin-bottom: 0.4rem;
}

p { margin: 0 0 1.1em; }
p:last-child { margin-bottom: 0; }

em, i { font-family: var(--serif-italic); font-style: italic; }
strong, b { font-weight: 500; }

a {
  color: var(--link);
  font-weight: var(--link-weight);
  text-decoration: none;
  transition: color var(--motion-hover) ease, background-color var(--motion-hover) ease,
    box-shadow var(--motion-hover) ease;
}
a:hover {
  color: var(--on-accent);
  background: var(--accent);
  text-decoration: none;
  box-shadow: 0 0 0 3px var(--accent);
  border-radius: var(--radius-link);
}
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Masthead */
.masthead { margin-bottom: 1.75rem; }
.dateline {
  display: block;
  margin-top: 0.35rem;
  font-family: var(--serif-italic);
  font-style: italic;
  font-size: var(--type-small);
}

.crumb { display: inline-block; margin-bottom: 2.25rem; font-size: var(--type-small); }

/* Project list */
.projects { list-style: none; margin: 0; padding: 0; }
.projects li {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 1.5rem;
  row-gap: 0.15rem;
  padding: var(--space-row) 0 1rem;
}
.projects .title, .projects .title a { font-weight: 500; }
.projects .when { font-size: var(--type-small); white-space: nowrap; padding-top: 0.2em; }
.projects .blurb { grid-column: 1 / -1; margin: 0.15rem 0 0; }
.projects .blurb a { white-space: nowrap; }

@media (max-width: 480px) {
  .projects li { grid-template-columns: 1fr; }
  .projects .when { padding-top: 0; }
}

/* Long-form */
article ul, article ol { padding-left: 1.15rem; margin: 0 0 1.1em; }
article li { margin-bottom: 0.4em; }

pre, code { font-family: var(--code); font-size: var(--type-small); }
code { background: var(--code-bg); padding: 0.1em 0.35em; border-radius: var(--radius-code); }
pre {
  background: var(--code-bg);
  padding: var(--space-code) 1.1rem;
  border-radius: var(--radius-code);
  overflow-x: auto;
  line-height: 1.5;
  margin: 1.25rem 0;
}
pre code { background: none; padding: 0; font-size: 1em; }

blockquote {
  margin: 1.5rem 0;
  padding-left: 1rem;
  border-left: 2px solid var(--link);
  font-family: var(--serif-italic);
  font-style: italic;
}

.scroll { overflow-x: auto; margin: 1.25rem 0; }
table { border-collapse: collapse; width: 100%; font-size: var(--type-small); }
th, td {
  text-align: left;
  padding: 0.45rem 1rem 0.45rem 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
th { font-weight: 500; }
td.num, th.num { text-align: right; padding-right: 0; }

footer {
  max-width: var(--measure);
  margin: var(--space-section) auto 0;
  padding: 1.5rem 1rem 3rem;
  font-size: var(--type-small);
}
@media (max-width: 768px) { footer { padding: 1.5rem 1.25rem 3rem; } }
footer p { margin: 0; }

html.theme-transition { transition: background-color 210ms ease-out, color 210ms ease-out; }

/* The case seam is the pivot point for the lid. */
#theme-toggle {
  position: fixed;
  z-index: 10;
  top: .75rem;
  right: 1rem;
  width: 74px;
  height: 78px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
}

#theme-toggle:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

.lighter {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transition: transform 180ms ease-out;
}

.lighter img { position: absolute; display: block; }

.lighter-body { top: 26px; left: 33px; }

.lighter-lid {
  top: 19px;
  left: 33px;
  transform-origin: 2px 25px;
  transition: transform 280ms cubic-bezier(.3, .7, .3, 1) 30ms;
}

.lighter-flame {
  top: 1px;
  left: 43px;
  opacity: 0;
  transform: scale(.55, .1);
  transform-origin: center bottom;
  filter: drop-shadow(0 0 5px #ff9e45aa);
  transition: opacity 85ms ease-out, transform 105ms ease-out;
}

#theme-toggle[aria-pressed="true"] .lighter-lid {
  transform: rotate(-110deg);
  transition-duration: 325ms;
  transition-delay: 0ms;
  transition-timing-function: cubic-bezier(.22, 1.12, .32, 1);
}

#theme-toggle[aria-pressed="true"] .lighter-flame {
  opacity: 1;
  transform: scale(1);
  transition: opacity 150ms ease-out 140ms, transform 300ms cubic-bezier(.2, 1.35, .45, 1) 130ms;
}

#theme-toggle[data-animate][aria-pressed="true"] .lighter::after {
  content: "";
  position: absolute;
  top: 25px;
  left: 46px;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  color: #ffd480;
  background: currentColor;
  box-shadow: 4px -3px currentColor, -3px -4px currentColor;
  animation: spark 300ms ease-out 135ms both;
}

@keyframes spark {
  0% { opacity: 0; transform: scale(.6); }
  18% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-8px) scale(1.6); }
}

.lighter::before {
  content: "";
  position: absolute;
  inset: 18px -4px -8px 8px;
  border-radius: 50%;
  background: radial-gradient(ellipse, #e7ad4240, #e7ad4200 70%);
  opacity: 0;
  transition: opacity 160ms ease-out;
}

@media (hover: hover) {
  #theme-toggle:hover .lighter::before { opacity: 1; }
}
#theme-toggle:focus-visible .lighter::before { opacity: 1; }
#theme-toggle:active .lighter { transform: scale(.97); }

@media (max-width: 480px) {
  #theme-toggle { top: .25rem; right: .35rem; }
}

.pin { white-space: nowrap; }
.pin svg { display: inline-block; vertical-align: -1px; margin-right: .25em; color: var(--link); }

.shell { width: min(100% - clamp(40px, 9vw, 144px), 1100px); max-width: none; margin-inline: auto; }
.site-header, .site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: var(--type-small);
}
.site-header { padding-block: 1.1rem; flex-wrap: wrap; }
.site-header nav { display: flex; flex-wrap: wrap; gap: .5rem clamp(12px, 3vw, 30px); }
.site-footer { margin-top: 0; }
.site-footer small { font-size: inherit; }
.inner { padding: var(--space-section) 0; }
.page-title { font-size: clamp(32px, 5vw, 48px); margin-bottom: 1.25rem; }
.back-link { display: inline-block; margin-bottom: 1.25rem; font-size: var(--type-small); }
.project-page .page-title { font-size: 24px; }
.project-story { max-width: 42rem; font-size: 18px; }
.credits { font-size: 16px; }
.project-links { font-size: var(--type-small); }
.project-links { display: flex; flex-wrap: wrap; gap: .35rem 1.25rem; }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.75rem clamp(12px, 2.1vw, 24px);
  list-style: none;
  margin: 0;
  padding: 0;
}
.gallery-grid figure, .photo-strip figure { margin: 0; }
.gallery-grid a, .photo-strip a { display: block; }
.gallery-grid img, .photo-strip img { display: block; width: 100%; height: auto; }
.gallery-grid img { aspect-ratio: 4 / 3; object-fit: cover; background: var(--code-bg); }
.gallery-grid figcaption { padding: .45rem .25rem .15rem; }
.gallery-type { display: block; font-size: var(--type-small); }

.photo-strip {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 24px);
  overflow-x: auto;
  margin-top: 2rem;
  padding: 8px 0 18px;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}

.photo-strip::-webkit-scrollbar { display: none; }

.photo-strip figure { flex: 0 0 auto; scroll-snap-align: start; }
.photo-strip a { height: clamp(240px, 52svh, 520px); }
.photo-strip a:hover { background: transparent; box-shadow: none; }
.photo-strip img { width: auto; height: 100%; max-width: none; }
.photo-strip:focus-visible { outline: 2px solid var(--link); outline-offset: 4px; }

@media (max-width: 760px) {
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  a, html.theme-transition, #theme-toggle .lighter, #theme-toggle .lighter img, #theme-toggle .lighter::before { transition: none; }
  #theme-toggle[data-animate][aria-pressed="true"] .lighter::after { animation: none; content: none; }
}

.effect-filters { position: absolute; pointer-events: none; }

.name {
  position: relative;
  width: fit-content;
  max-width: 100%;
  font-family: "Pinyon Script", "Snell Roundhand", cursive;
  font-size: clamp(44px, 7vw, 56px);
  line-height: 1.25;
  letter-spacing: 0;
}

.name { margin-left: -.4em; }
.name-solid { padding: .18em .4em; }

.name-solid { display: block; }

@media (hover: hover) and (pointer: fine) {
  .name[data-grain-active] .name-solid { filter: url("#letter-grain"); }
}

@media (prefers-reduced-motion: reduce) {
  .name { transition: none; }
}


.name-link {
  flex-shrink: 0;
  color: var(--ink);
  font-size: 32px;
  font-weight: 400;
}

.name-link:hover {
  color: var(--ink);
  background: transparent;
  box-shadow: none;
}

.sigil-reveal {
  position: fixed;
  z-index: 1;
  --sigil-top: 21.899svh;
  --sigil-left: 14.491vw;
  --sigil-width: 20.123vw;
  --sigil-render-top: clamp(8px, var(--sigil-top), max(8px, calc(100svh - var(--footer-clearance, 80px) - 120px)));
  --sigil-render-left: clamp(0px, var(--sigil-left), calc(100vw - 48px));
  top: var(--sigil-render-top);
  left: var(--sigil-render-left);
  width: min(
    var(--sigil-width),
    calc(100vw - var(--sigil-render-left)),
    calc((100svh - var(--sigil-render-top) - var(--footer-clearance, 80px)) * 941 / 1672)
  );
  aspect-ratio: 941 / 1672;
  pointer-events: none;
  opacity: .85;
  --sigil-fade-ms: 3000;
  transition: opacity calc(var(--sigil-fade-ms) * 1ms) ease-out;
}

.sigil-trail {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.sigil-reveal::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--link);
  mask: var(--sigil-image, url("/media/sigil/cybersigil.png")) center / contain no-repeat;
  transform: rotate(var(--sigil-rotation, 180deg));
}

.sigil-reveal::before { opacity: 0; transition: opacity 400ms ease-out; }
.sigil-reveal[data-state="shown"]::before,
.sigil-reveal[data-state="fading"]::before { opacity: 1; }
.sigil-reveal[data-state="exploring"],
.sigil-reveal[data-state="exploring"]::before { transition: none; }
.sigil-reveal[data-state="fading"] { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  .sigil-reveal, .sigil-reveal::before { transition: none; }
}

.sigil-reveal[data-editing] {
  display: block;
  pointer-events: auto;
  z-index: 30;
  mask-image: none;
  opacity: .85;
  outline: 1px dashed var(--link);
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.sigil-reveal[data-editing]::before { opacity: 1; }
.sigil-reveal[data-editing]:active { cursor: grabbing; }

.sigil-resize {
  position: absolute;
  right: -7px;
  bottom: -7px;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 2px solid var(--paper);
  background: var(--link);
  cursor: nwse-resize;
}

.sigil-editor {
  position: fixed;
  z-index: 40;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 12px 16px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--rule);
  font-size: var(--type-small);
}

.sigil-editor label { display: flex; align-items: center; gap: 8px; }
.sigil-editor input { width: 140px; accent-color: var(--link); }
.sigil-editor button {
  padding: 6px 12px;
  font: inherit;
  color: var(--paper);
  background: var(--link);
  border: 0;
  cursor: pointer;
}

.sigil-second {
  --sigil-image: url("/media/sigil/cybersigil-2.png");
  --sigil-rotation: 0deg;
  --sigil-left: 61.114vw;
  --sigil-top: 2.716svh;
  --sigil-width: 16.410vw;
}

.sigil-reveal[data-preview] { display: block; opacity: .3; }
.sigil-reveal[data-preview]::before { opacity: 1; }

.home main > p { font-size: 16px; }
.home-footer { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 1rem; }
.home-footer nav { display: flex; gap: 1rem; }


body { padding-bottom: calc(5rem + env(safe-area-inset-bottom)); }

footer {
  position: fixed;
  z-index: 5;
  bottom: 0;
  left: 0;
  right: 0;
  margin-block: 0;
  padding-block: 1.1rem calc(1.1rem + env(safe-area-inset-bottom));
  background: transparent;
}

.portraits-index .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 480px) {
  .portraits-index .gallery-grid { grid-template-columns: 1fr; }
}

.home main {
  width: min(600px, calc(100% - 40px));
  max-width: 600px;
  margin-inline: auto;
  padding: 80px 0 4rem;
}
.home-footer {
  width: min(600px, calc(100% - 40px));
  max-width: 600px;
  padding-inline: 0;
}
@media (max-width: 768px) {
  .home main { padding-top: 96px; }
}
@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  body.home {
    position: fixed;
    inset: 0;
    height: 100svh;
    padding: 96px 0 calc(var(--footer-clearance, 80px) + env(safe-area-inset-bottom));
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: pinch-zoom;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .home main {
    flex-shrink: 0;
    margin-block: 0;
    padding-block: 0;
    transform: translateY(var(--home-content-shift, 0px)) scale(var(--home-content-scale, 1));
    transform-origin: center;
  }
  .home .sigil-reveal {
    --sigil-top: calc(var(--home-content-top, 120px) + var(--home-content-height, 400px) * .4 + 32px) !important;
    --sigil-left: 0px !important;
    --sigil-width: 38vw !important;
  }
  .home .sigil-second {
    --sigil-top: max(100px, calc(var(--home-content-top, 120px) - 24px)) !important;
    --sigil-left: 62vw !important;
  }
}
