/* Redaction (OFL, see fonts/LICENSE-Redaction.txt): the pixelated "50" cut for the name,
   the clean cut for labels and highlights. */
@font-face { font-family: 'Redaction 50'; font-style: normal; font-display: swap; src: url(/fonts/Redaction50-Regular.woff2) format('woff2'); }
@font-face { font-family: 'Redaction 50'; font-style: italic; font-display: swap; src: url(/fonts/Redaction50-Italic.woff2) format('woff2'); }
@font-face { font-family: 'Redaction'; font-style: normal; font-display: swap; src: url(/fonts/Redaction-Regular.woff2) format('woff2'); }
@font-face { font-family: 'Redaction'; font-style: italic; font-display: swap; src: url(/fonts/Redaction-Italic.woff2) format('woff2'); }

/* Theme tokens are registered as colors so a theme change fades instead of snapping. */
@property --paper { syntax: '<color>'; inherits: true; initial-value: #FFFFFF; }
@property --ink { syntax: '<color>'; inherits: true; initial-value: #1A1A1A; }
@property --muted { syntax: '<color>'; inherits: true; initial-value: #666666; }
@property --faint { syntax: '<color>'; inherits: true; initial-value: #767676; }
@property --accent { syntax: '<color>'; inherits: true; initial-value: #B5501E; }
@property --marker { syntax: '<color>'; inherits: true; initial-value: #C9875A; }
@property --rule { syntax: '<color>'; inherits: true; initial-value: #BDBDBD; }
@property --underline { syntax: '<color>'; inherits: true; initial-value: #C9C9C9; }
@property --selection { syntax: '<color>'; inherits: true; initial-value: #F3DCC6; }

:root {
  color-scheme: light;
  --paper: #FFFFFF;
  --ink: #1A1A1A;
  --muted: #666666;
  --faint: #767676;
  --accent: #B5501E;
  --marker: #C9875A;
  --rule: #BDBDBD;
  --underline: #C9C9C9;
  --selection: #F3DCC6;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --calm: cubic-bezier(.45, .05, .25, 1);
  --display: 'Redaction 50', 'Redaction', Georgia, serif;
  --label: 'Redaction', Georgia, serif;
}

/* main.js adds .theme-fade when the theme changes, so the first paint never fades. */
:root.theme-fade {
  transition-property: --paper, --ink, --muted, --faint, --accent, --marker, --rule, --underline, --selection;
  transition-duration: 1.5s;
  transition-timing-function: var(--calm);
}

/* Dark tokens. The dot colors in main.js (PALETTES) mirror these. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #161514;
  --ink: #ECE8E1;
  --muted: #A39E96;
  --faint: #8F8A83;
  --accent: #E08A5C;
  --marker: #A86A47;
  --rule: #4A4641;
  --underline: #4F4A44;
  --selection: #5A3420;
}

/* Without JavaScript (no data-theme), follow the system setting. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --paper: #161514;
    --ink: #ECE8E1;
    --muted: #A39E96;
    --faint: #8F8A83;
    --accent: #E08A5C;
    --marker: #A86A47;
    --rule: #4A4641;
    --underline: #4F4A44;
    --selection: #5A3420;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 18px;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
}

::selection { background: var(--selection); color: var(--ink); }
li::marker { color: var(--marker); }

/* Links: a grey hairline that fills with the accent color on hover. */
a {
  color: var(--ink);
  text-decoration: none;
  background-image: linear-gradient(var(--accent), var(--accent)), linear-gradient(var(--underline), var(--underline));
  background-size: 0% 1px, 100% 1px;
  background-position: 0 100%, 0 100%;
  background-repeat: no-repeat;
  padding-bottom: 1px;
  transition: background-size .45s var(--ease), color .25s;
}
a:hover, a:focus-visible { color: var(--accent); background-size: 100% 1px, 100% 1px; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Dot field drawn by main.js, fixed behind the content. */
.field {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* Theme picker: the button shows the theme in effect (sun or moon, morphing between the
   two); hovering or clicking it opens System / Light / Dark. */
.theme-picker {
  position: absolute;
  top: clamp(12px, 3vw, 28px);
  right: clamp(12px, 3vw, 28px);
  z-index: 2;
}
.theme-picker[hidden] { display: none; }
.theme-toggle {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color .3s;
}
.theme-toggle:hover, .theme-picker.open .theme-toggle { color: var(--accent); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle svg { display: block; overflow: visible; }
.theme-toggle .core,
.theme-toggle .cut,
.theme-toggle .rays {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 1.1s var(--calm), opacity .8s var(--calm);
}
.theme-toggle .core { transform: scale(.75); }
.theme-toggle .cut { transform: translate(8px, -8px); }
[data-theme="dark"] .theme-toggle .core,
[data-theme="dark"] .theme-toggle .cut { transform: none; }
[data-theme="dark"] .theme-toggle .rays { opacity: 0; transform: rotate(-45deg) scale(.6); }

/* A slim column of icons directly under the button; the selected one is in the accent color. */
.theme-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  width: 44px;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 22px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity .3s var(--calm), transform .4s var(--calm), visibility 0s linear .4s;
}
/* Invisible bridge over the gap, so moving the pointer down doesn't close the menu. */
.theme-menu::before { content: ''; position: absolute; left: 0; right: 0; bottom: 100%; height: 8px; }
.theme-picker.open .theme-menu { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
@media (hover: hover) {
  .theme-picker:hover .theme-menu { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
}
.theme-menu button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color .25s;
}
.theme-menu button:hover { color: var(--ink); }
.theme-menu button:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; }
.theme-menu button[aria-pressed="true"] { color: var(--accent); }
.theme-menu svg { display: block; }

main {
  position: relative;
  z-index: 1;
  max-width: 820px;
  padding: clamp(56px, 10vw, 136px) clamp(20px, 6vw, 40px) 72px clamp(20px, 12vw, 200px);
}

p, h1, h2 { margin: 0; }
/* Highlights (company and project names) in the clean Redaction cut. */
strong, .proj .nm a {
  font-family: var(--label);
  font-size: 19.5px;
  font-weight: 400;
}

/* Header */
.intro { margin-bottom: 72px; }
.kicker {
  margin-bottom: 18px;
  color: var(--accent);
  font-family: var(--label);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
h1 {
  font-family: var(--display);
  font-size: clamp(52px, 7vw, 88px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.02em;
}
.accent { font-style: italic; color: var(--accent); }
.contact { margin-top: 16px; font-family: var(--label); font-size: 19.5px; }
.lede { margin-top: 28px; max-width: 560px; }
.links { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 4px 22px; }

/* Sections: label on the left, content on the right; they stack when narrow. */
.block {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 32px;
  padding-top: 28px;
  border-top: 1px dotted var(--rule);
  margin-bottom: 60px;
}
.block.last { margin-bottom: 80px; }
.block h2 {
  flex: 1 1 120px;
  font-family: var(--label);
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  line-height: 2.2;
}
.block-body { flex: 999 1 480px; min-width: 0; }
.work, .projects { display: flex; flex-direction: column; }
.work { gap: 36px; }
.projects { gap: 28px; }
.also p + p { margin-top: 12px; }

.row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 16px; }
/* Dates, project tags and the footer in Redaction italic. */
.meta { color: var(--muted); font-family: var(--label); font-style: italic; }
.stack { margin-top: 2px; color: var(--muted); font-size: 16px; font-style: italic; }
.note { margin-top: 10px; }

ul {
  margin: 12px 0 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Projects */
.proj p { margin-top: 6px; }
.proj .nm { display: inline-block; transition: transform .35s var(--ease); }
.proj .lang { transition: color .3s; }
/* Hovering a project slowly 'degrades' its name into the pixelated cut: the clean text
   fades out while a Redaction 50 copy (same metrics) fades in on top. */
.proj .nm a { position: relative; }
.proj .nm .clean { transition: opacity .7s var(--calm); }
.proj .nm a::after {
  content: attr(data-text);
  content: attr(data-text) / "";
  position: absolute;
  left: 0;
  top: 0;
  font-family: 'Redaction 50', var(--label);
  opacity: 0;
  pointer-events: none;
  transition: opacity .7s var(--calm);
}
.proj:hover .nm .clean, .proj .nm a:focus-visible .clean { opacity: 0; }
.proj:hover .nm a::after, .proj .nm a:focus-visible::after { opacity: 1; }
.proj:hover .nm { transform: translateX(4px); }
.proj:hover .lang { color: var(--accent); }

footer {
  font-family: var(--label);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  color: var(--faint);
  font-size: 15px;
  font-style: italic;
}

/* Entrance */
.rise { animation: rise .9s var(--ease) both; animation-delay: var(--delay, 0ms); }
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .rise { animation: none; }
  .proj .nm, a { transition: none; }
  /* Keep the color fade (it isn't motion) but make it quicker, and don't spin the icon. */
  :root.theme-fade { transition-duration: .6s; }
  .theme-toggle .core, .theme-toggle .cut, .theme-toggle .rays { transition: none; }
  .theme-menu { transform: none; }
}
