@font-face {
  font-family: 'Timeless Sans';
  src: url('media/fonts/TimelessSansVF.woff2') format('woff2');
  font-weight: 300 800;
  font-display: swap;
}

:root {
  --ink: #000;
  --muted: rgb(0 0 0 / 50%);
  --line: rgb(0 0 0 / 10%);
  --wash: rgb(0 0 0 / 5%);
  --paper: #fff;
  --card: #fff;
  --weight: 400;   /* body text weight */
  /* Timeless Sans variants, pick one for --variant: grotesk | sans | italic | sans-italic */
  --grotesk: 'STYL' 0, 'ital' 0;
  --sans: 'STYL' 100, 'ital' 0;
  --italic: 'STYL' 0, 'ital' 100;
  --sans-italic: 'STYL' 100, 'ital' 100;
  --variant: var(--grotesk);
  --scale: 1;   /* scales all type and its line heights; 1.1 is 10% larger */
  --font: 'NoInter', 'Timeless Sans', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --preview-grey: 50%;   /* how grey the project previews are until hovered */
  --logo-size: 24px;   /* width of the static logo image and the colour grid */
  --grid-1: rgb(59 130 246);
  --grid-2: rgb(34 197 94);
  --grid-3: rgb(245 158 11);
  --grid-4: rgb(6 182 212);
  --grid-5: rgb(234 179 8);
  --grid-6: rgb(236 72 153);
  --grid-7: rgb(139 92 246);
  --grid-8: rgb(249 115 22);
  --grid-9: rgb(239 68 68);
  --preview-width: 200px;   /* hover previews never exceed this */
  --preview-height: 120px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

* { box-sizing: border-box; }

html { background: var(--paper); font-size: calc(100% * var(--scale)); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  padding: 60px 40px;
  color: var(--ink);
  font: var(--weight) .875rem/1.4375rem var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-kerning: normal;
  text-wrap: pretty;
  font-variation-settings: var(--variant);
  text-transform: lowercase;
}

main { max-width: 580px; margin: 0 auto; }
h1, h2, p { margin: 0; font: inherit; }
h1, h2 { text-wrap: balance; }

a {
  color: inherit;
  text-decoration: none;
  padding-bottom: 2px;
  background:
    repeating-linear-gradient(90deg, currentColor 0 1px, transparent 1px 3px) 0 100% / 0% 1px no-repeat,
    repeating-linear-gradient(90deg, color-mix(in srgb, currentColor 35%, transparent) 0 1px, transparent 1px 3px) 0 100% / 100% 1px no-repeat;
  box-decoration-break: clone;
  transition: background-size 0.35s var(--ease);
}
a:hover { background-size: 100% 1px, 100% 1px; }
a:focus-visible { outline: 1px solid currentColor; outline-offset: 4px; border-radius: 1px; }

/* --- Reveal --- */
main > * { animation: rise 0.6s var(--ease) both; }
main > :nth-child(2) { animation-delay: 80ms; }
main > :nth-child(3) { animation-delay: 160ms; }
main > :nth-child(4) { animation-delay: 240ms; }
main > :nth-child(5) { animation-delay: 320ms; }
main > :nth-child(6) { animation-delay: 400ms; }
main > :nth-child(7) { animation-delay: 480ms; }
main > :nth-child(n+8) { animation-delay: 560ms; }

@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
@keyframes fade { from { opacity: 0; } }

/* --- Header --- */
.occupation { margin-top: 2px; color: var(--muted); }

.about-me { margin-top: 32px; line-height: 1.625rem; }
.about-me > p + p { margin-top: 16px; }

.about-socials { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; }


/* --- Logo: click to toss a coin; it lands on the other face and stays there --- */
.logo-container {
  display: block;
  position: relative;
  width: 96px;
  height: 78px;
  margin: 0 0 24px -12px;
  padding: 0;
  border: 0;
  background: none;
  perspective: 500px;
  cursor: pointer;
}
.logo { display: block; width: var(--logo-size); height: auto; margin: 0 0 24px; }
.logo-grid { display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); width: var(--logo-size); aspect-ratio: 1; margin: 0 0 24px; }
.logo-grid span { background-color: var(--cell); transition: background-color 0.3s var(--ease); }
.logo-grid span:nth-child(1) { --cell: var(--grid-1); }
.logo-grid span:nth-child(2) { --cell: var(--grid-2); }
.logo-grid span:nth-child(3) { --cell: var(--grid-3); }
.logo-grid span:nth-child(4) { --cell: var(--grid-4); }
.logo-grid span:nth-child(5) { --cell: var(--grid-5); }
.logo-grid span:nth-child(6) { --cell: var(--grid-6); }
.logo-grid span:nth-child(7) { --cell: var(--grid-7); }
.logo-grid span:nth-child(8) { --cell: var(--grid-8); }
.logo-grid span:nth-child(9) { --cell: var(--grid-9); }
.logo-container:focus-visible { outline: 1px solid currentColor; outline-offset: 4px; }

.coin {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform: rotateY(var(--angle, 0deg));
  transition: transform 1.2s cubic-bezier(0.2, 0.6, 0.2, 1), rotate 0.25s var(--ease);
}

/* Hover hint: the coin leans slightly, as if about to go */
@media (hover: hover) {
  .logo-container:hover .coin { rotate: y 14deg; }
}

.coin img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  backface-visibility: hidden;
}

.coin img:last-child { transform: rotateY(180deg); }

/* The hop of the toss, on its own properties so it does not fight the spin */
.tossed .coin { animation: toss 1.2s ease-in-out; }

@keyframes toss { 40% { translate: 0 -20px; scale: 1.08; } }

/* --- Sections --- */
main > section { margin-top: 48px; }
section h2 { margin: 0 0 16px; color: var(--muted); }
section h2 span { color: var(--ink); }

.now { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.lately { color: var(--muted); }
.now time { margin-left: 8px; font-variant-numeric: tabular-nums; }

/* --- Project preview: below the link, beside it when there is room; its section sits above the next one --- */
main > section:has(.preview) { position: relative; z-index: 1; }
.now a:has(.preview) { position: relative; }

.preview {
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  z-index: 10;
  width: auto;
  height: auto;
  max-width: min(var(--preview-width), calc(100vw - 80px));
  max-height: var(--preview-height);
  border-radius: 12px;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 8%), 0 8px 40px rgb(0 0 0 / 8%);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px) scale(.98);
  transition: opacity 180ms ease, transform 220ms var(--ease), visibility 180ms;
}

a.open > .preview,
a:focus-visible > .preview { opacity: 1; visibility: visible; transform: none; }

@media (min-width: 760px) {
  .preview { top: 50%; left: calc(100% + 24px); translate: 0 -50%; }
}

/* --- Side hustles --- */
.studio-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (max-width: 639px) { .studio-grid { grid-template-columns: 1fr; } }

.studio-card { display: block; padding-bottom: 0; background: none; }
.studio-card:focus-visible { outline-offset: 4px; border-radius: 14px; }
.studio-card span { display: block; margin-top: 8px; }
.tba span { color: var(--muted); }

/* All cards share one shape; the image fills it */
.studio-preview {
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--wash);
}

.studio-preview img {
  display: block; width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.6s var(--ease), filter 0.6s var(--ease);
}

/* Half grey until hovered or focused; small screens keep the colours */
.studio-preview img { filter: grayscale(var(--preview-grey)); }
.studio-card:hover img, .studio-card:focus-visible img { filter: none; }
@media (max-width: 639px) { .studio-preview img { filter: none; } }

/* A small label in the corner, set with data-badge on the preview; remove the attribute when it is no longer new */
.studio-preview[data-badge] { position: relative; }
.studio-preview[data-badge]::after {
  content: attr(data-badge);
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 2px 10px 2px 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: radial-gradient(circle at 10px 50%, var(--ink) 3px, transparent 3.5px), var(--card);
  font-size: .75rem;
  line-height: 1.125rem;
}

.studio-card:hover img, .studio-card:focus-visible img { transform: scale(1.05); }

/* Declare an image as icon to centre it on a white ground */
.studio-preview:has(.icon) { background: var(--card); }
.icon, .studio-preview .icon { padding: 32px; background: var(--card); object-fit: contain; }

/* --- Article list --- */
.articles { display: grid; gap: 12px; margin: 32px 0 0; padding: 0; list-style: none; }
.articles li { display: flex; justify-content: space-between; gap: 16px; }
.empty { color: var(--muted); }
.articles .by, .articles .note { color: var(--muted); }
.articles .note { display: block; }
section .articles { margin-top: 0; }
.articles time { color: var(--muted); font-variant-numeric: tabular-nums; }

/* --- Article pages --- */
.path { margin-bottom: 32px; color: var(--muted); }
.path [aria-current] { color: var(--ink); }

article { margin-top: 32px; line-height: 1.625rem; }
article > * + * { margin-top: 16px; }
article h2 { margin-top: 32px; }
article ul, article ol { padding-left: 20px; }
.shot { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.button { padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px; background: none; }
.button.primary { border-color: var(--ink); background: var(--ink); color: var(--paper); }
@media (hover: hover) { .button:hover { background: var(--wash); } .button.primary:hover { background: var(--ink); opacity: .85; } }
.shot img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 14px; }
.model { margin: 0; }
.model svg { display: block; width: 100%; max-width: 420px; height: auto; }
.model text { fill: var(--muted); font-size: 12px; }
.model .name { fill: var(--ink); font-size: 15px; }
.model .node { fill: var(--paper); stroke: var(--ink); stroke-width: 1.5; }
.model .bar { fill: var(--ink); }
.model .soft { stroke: var(--muted); stroke-dasharray: 4 4; }
.model .bar.soft { fill: none; stroke-width: 1.5; }
.model .flow { fill: none; stroke: var(--ink); stroke-width: 1.5; marker-end: url(#tip); }
.model marker path { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.model figcaption { margin-top: 16px; color: var(--muted); font-size: .8125rem; line-height: 1.125rem; }
.tenets { counter-reset: tenet; border-top: 1px solid var(--line); }
.tenets details { counter-increment: tenet; border-bottom: 1px solid var(--line); }
.tenets summary { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; cursor: pointer; list-style: none; }
.tenets summary::-webkit-details-marker { display: none; }
.tenets summary span::before { content: counter(tenet) '. '; color: var(--muted); }
.tenets summary::after { content: '+'; color: var(--muted); }
.tenets details[open] summary::after { content: '−'; }
.tenets details p { margin: 0 0 12px; }
.tenets .how { color: var(--muted); }

/* --- Calculator --- */
.calculator { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px 32px; margin-top: 40px; }
.calculator .wide { grid-column: 1 / -1; }
.calculator label { display: grid; gap: 2px; color: var(--muted); font-size: .8125rem; line-height: 1.25rem; }
.calculator input {
  width: 100%;
  padding: 4px 0 8px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: none;
  color: var(--ink);
  font: var(--weight) 1.125rem/1.5rem var(--font);
  font-variant-numeric: tabular-nums;
  appearance: textfield;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.calculator input::-webkit-inner-spin-button, .calculator input::-webkit-outer-spin-button { appearance: none; margin: 0; }
.calculator input:hover { border-color: var(--muted); }
.calculator input:focus { outline: 0; border-color: var(--ink); box-shadow: 0 1px 0 var(--ink); }

.results { display: grid; gap: 40px; margin-top: 56px; }
.results h3 { margin: 0 0 12px; color: var(--muted); font: inherit; }

.indices { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px 16px; margin: 0; }
.indices dt { color: var(--muted); }
.indices dd { margin: 4px 0 0; font-size: 1.75rem; line-height: 2rem; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.indices small { display: block; margin-top: 4px; color: var(--muted); font-size: .8125rem; line-height: 1.125rem; }

.chart { margin: 0; }
.chart svg { display: block; width: 100%; height: 200px; overflow: visible; }
.chart text { fill: var(--muted); font-size: .6875rem; }
.chart .plan { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-linejoin: round; }
.chart .axis, .chart .guide { stroke: var(--line); stroke-width: 1; fill: none; }
.chart .lag { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 2 3; fill: none; }
.chart .earned { fill: var(--ink); }
.chart .actual { fill: var(--paper); stroke: var(--ink); stroke-width: 1.5; }
.chart .on-plan { fill: var(--paper); stroke: var(--muted); stroke-width: 1.5; }
.chart figcaption { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-top: 16px; color: var(--muted); font-size: .8125rem; line-height: 1.125rem; }
.chart figcaption span::before { content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; }
.chart .k-plan::before { width: 14px; height: 0; border-top: 1.5px solid var(--muted); border-radius: 0; vertical-align: middle; }
.chart .k-earned::before { background: var(--ink); }
.chart .k-actual::before { border: 1.5px solid var(--ink); }

.results dl:not(.indices) { display: grid; grid-template-columns: 1fr auto; margin: 0; }
.results dl:not(.indices) dt, .results dl:not(.indices) dd { padding: 8px 0; border-top: 1px solid var(--line); }
.results dl:not(.indices) dt span { display: inline-block; margin-left: 8px; color: var(--muted); white-space: nowrap; }
.results dl:not(.indices) dd { margin: 0; padding-left: 16px; text-align: right; font-variant-numeric: tabular-nums; }

@media (max-width: 479px) {
  .calculator { grid-template-columns: 1fr; gap: 20px; }
  .indices { grid-template-columns: repeat(2, 1fr); }
}

/* --- Footer --- */
footer { margin-top: 80px; color: var(--muted); font-size: .75rem; line-height: 1.25rem; }
.local-conditions { display: flex; flex-wrap: wrap; gap: 4px 8px; margin-top: 8px; font-variant-numeric: tabular-nums; }

/* --- Media Queries --- */
@media (max-width: 1199px) { body { font-size: .9375rem; line-height: 1.5rem; } }
@media (max-width: 359px) { body { padding-right: 24px; padding-left: 24px; } }
@media (prefers-reduced-motion: reduce) {
  main > * { animation-name: fade; }
  .coin, .preview, .studio-preview img { transition: none; }
  .tossed .coin { animation: none; }
}