/* =========================================================================
   Thoth Studio — thothstudio.co
   A modern editorial page with a few artefacts from an older internet
   still running inside it. No frameworks, no webfonts, no build step.
   ========================================================================= */

/* -- 1. Tokens ---------------------------------------------------------- */

:root {
  /* Neutrals — warm, papery, never pure white */
  --paper:        #F3F0E8;
  --paper-deep:   #EBE7DC;
  --ink:          #171916;
  --ink-muted:    #6E7169;
  --rule:         rgba(23, 25, 22, 0.13);

  /* Jade — the thread stitching the modern and ancient layers together */
  --jade:         #4F7F68;
  --jade-dark:    #315845;
  --jade-soft:    #89A995;
  --jade-wash:    #DCE7DF;

  /* Materials confined to the artefact */
  --note:         #FBF6DC;
  --note-rule:    #C9D8CB;
  --note-margin:  #C0402F;
  --note-ink:     #2C3A30;
  --note-label:   #8A7F5E;

  /* Deliberately tasteless, in microscopic doses */
  --led:          #5FD08A;
  --amber:        #FFA92B;

  /* Type */
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI",
          "Helvetica Neue", Helvetica, Arial, sans-serif;
  --old:  Verdana, Geneva, "DejaVu Sans", Tahoma, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas,
          "Liberation Mono", monospace;

  /* Rhythm of the ruled paper. Everything inside the note is a multiple. */
  --ruling: 22px;

  --base-rot: -1.4deg;
}

/* -- 2. Reset ----------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  overflow-x: clip;               /* belt and braces against the tilted artefact */
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, p, ul, dl, dd, figure, figcaption { margin: 0; }
dd { margin-inline-start: 0; }

a { color: inherit; }

button {
  font: inherit;
  color: inherit;
  margin: 0;
}

svg { display: block; }

::selection { background: var(--jade-wash); color: var(--ink); }

:where(a, button):focus-visible {
  outline: 2px solid var(--jade);
  outline-offset: 3px;
  border-radius: 2px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* -- 3. Paper grain ----------------------------------------------------- */
/* Almost subconscious. Just enough to stop the flat colour reading as screen. */

.grain {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  opacity: 0.038;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* -- 4. Frame ----------------------------------------------------------- */

.page {
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  row-gap: clamp(56px, 8vh, 104px);
  padding-block: clamp(26px, 4.4vh, 44px) clamp(22px, 3.4vh, 36px);
}

.shell {
  width: min(1320px, 100% - 12vw);
  margin-inline: auto;
}

.micro {
  font-family: var(--old);
  font-size: 9px;
  line-height: 1;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* -- 5. Masthead -------------------------------------------------------- */

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
}

.wordmark__text {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.19em;
  text-transform: uppercase;
  color: var(--ink);
  white-space: nowrap;
}

.wordmark__mark { flex: none; }

.sysbadge { white-space: nowrap; }

.glyph-ring,
.glyph-bird {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.glyph-ring { stroke: var(--jade-soft); stroke-width: 1.9; transition: stroke 160ms ease; }
.glyph-bird { stroke: var(--jade-dark); }
.glyph-dot  { fill: var(--jade-soft); transition: fill 160ms ease; }

.wordmark:hover .glyph-ring { stroke: var(--jade); }
.wordmark:hover .glyph-dot  { fill: var(--jade); }

/* The status label. An OS element that wandered onto a website. */
.sysbadge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--old);
  font-size: 9px;
  line-height: 1;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* -- 6. Stage ----------------------------------------------------------- */

.stage {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: clamp(20px, 2.6vw, 44px);
  align-items: center;
  align-content: center;    /* stage sits inside a stretched 1fr row; centre
                                within it rather than letting rows stretch */
}

/* -- 7. Hero ------------------------------------------------------------ */

.hero { grid-column: 1 / 8; }

.hero__title {
  font-size: clamp(2.9rem, 7.4vw, 5.6rem);
  font-weight: 600;
  letter-spacing: -0.037em;
  line-height: 0.94;
  text-wrap: balance;
  margin-bottom: clamp(22px, 2.6vw, 34px);
}

.hero__lead {
  max-width: 34ch;
  font-size: clamp(1rem, 1.06vw, 1.125rem);
  line-height: 1.55;
  letter-spacing: -0.006em;
  color: var(--ink-muted);
  text-wrap: pretty;
}

.contact {
  margin-top: clamp(28px, 4.4vw, 58px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 9px;
}

.contact__label { color: var(--jade); }

.contact__link {
  font-size: clamp(1.0625rem, 1.2vw, 1.25rem);
  letter-spacing: -0.012em;
  text-decoration: none;
  padding-bottom: 3px;
  box-shadow: inset 0 -1px 0 var(--jade-soft);
  transition: box-shadow 140ms ease, color 140ms ease;
}
.contact__link:hover {
  color: var(--jade-dark);
  box-shadow: inset 0 -2px 0 var(--jade);
}

/* -- 8. The artefact ---------------------------------------------------- */
/* Old chrome wrapped around a yellowed note page, left sitting on top of
   an otherwise pristine layout.                                           */

.artefact-wrap {
  grid-column: 8 / 13;
  justify-self: end;
  margin-right: -3.4vw;             /* break the grid, stay inside the gutter */
  margin-top: clamp(48px, 11vh, 132px);   /* sit low and right of the headline */
}

.artefact {
  width: 304px;
  border: 1px solid rgba(23, 25, 22, 0.36);
  border-radius: 6px;
  overflow: hidden;
  background: var(--note);
  transform:
    translate3d(var(--px, 0px), var(--py, 0px), 0)
    rotate(calc(var(--base-rot) + var(--pr, 0deg)));
  /* One hard 2009 shadow, one soft modern one. Both, on purpose. */
  box-shadow:
    3px 4px 0 rgba(23, 25, 22, 0.055),
    0 24px 46px -22px rgba(23, 25, 22, 0.55);
}

/* 8a. Brushed aluminium title bar */
.artefact__bar {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 25px;
  padding: 0 6px;
  border-bottom: 1px solid #A5A59E;
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,.025) 0 1px, transparent 1px 3px),
    linear-gradient(#FCFCFA, #E6E6DF 46%, #D3D3CB 54%, #CACAC2);
  box-shadow: inset 0 1px 0 #FFF;
}

.artefact__title {
  flex: 1;
  text-align: center;
  font-family: var(--old);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: #4E4E47;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.92);
}

.screw {
  flex: none;
  width: 6px; height: 6px;
  border-radius: 50%;
  background:
    linear-gradient(90deg, transparent 42%, rgba(0,0,0,.4) 42% 58%, transparent 58%),
    radial-gradient(circle at 32% 28%, #FDFDFB, #B6B6AE 70%, #8E8E87);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.16), 0 1px 0 rgba(255,255,255,.75);
}

.closebox {
  flex: none;
  width: 14px; height: 14px;
  display: grid;
  place-items: center;
  font: 700 10px/1 var(--old);
  color: #57574F;
  border: 1px solid #9C9C95;
  border-radius: 3px;
  background: linear-gradient(#FBFBF9, #DEDED7 52%, #CFCFC7);
  box-shadow: inset 0 1px 0 #FFF, 0 1px 0 rgba(255,255,255,.6);
  text-shadow: 0 1px 0 rgba(255,255,255,.8);
}

/* 8b. Leather strip and stitching — the Notes-app cue */
.artefact__leather {
  position: relative;
  height: 12px;
  background: linear-gradient(#7A5636, #5E3E26 52%, #4C3019);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.13),
    inset 0 -1px 0 rgba(0, 0, 0, 0.5);
}
.artefact__leather::after {
  content: "";
  position: absolute;
  top: 4px; left: 10px; right: 10px;
  height: 1px;
  background: repeating-linear-gradient(90deg,
    rgba(222, 202, 163, 0.62) 0 2px, transparent 2px 5px);
}

/* 8c. Yellowed ruled paper.
   The ruling, the row height and the baseline strut below are one system:
   every line of type lands exactly on a rule, the way it would on a pad. */
.artefact__paper {
  padding: var(--ruling) 18px 16px 34px;
  background-color: var(--note);
  background-image:
    linear-gradient(90deg, transparent 0 25px,
      rgba(192, 64, 47, 0.42) 25px 26px, transparent 26px),
    repeating-linear-gradient(180deg,
      transparent 0 15px,
      var(--note-rule) 15px 16px,
      transparent 16px var(--ruling));
  box-shadow: inset 0 3px 6px -3px rgba(74, 46, 26, 0.5);
}

.readout { position: relative; }

.readout__row {
  position: relative;
  display: flex;
  align-items: baseline;
  height: var(--ruling);
}

/* Zero-width strut: forces the row's baseline to 16px, which is where the
   ruling sits. Without it the flex baseline drifts with the font metrics. */
.readout__row::before {
  content: "";
  display: inline-block;
  width: 0;
  height: 16px;
}

.readout dt {
  flex: 1 1 auto;
  display: flex;
  align-items: baseline;
  font-family: var(--old);
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--note-label);
  white-space: nowrap;
}

/* Dotted leaders, lifted off the baseline so they read as a rule not a strike */
.readout dt::after {
  content: "";
  flex: 1 1 auto;
  margin: 0 8px;
  transform: translateY(-3px);
  border-bottom: 1px dotted rgba(74, 62, 32, 0.34);
}

.readout dd {
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--note-ink);
}

/* The LED sits out in the margin, left of the red rule, so that every
   label still starts on the same vertical. */
.readout .led {
  position: absolute;
  left: -23px;
  top: 8px;
}

.artefact__foot {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

/* The one modern element inside the antique frame */
.artefact__domain {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.055em;
  color: var(--ink);
}

/* 8d. Offensively 2009 jade plastic */
.okbtn {
  position: relative;
  padding: 6px 15px 7px;
  font-family: var(--old);
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #FFF;
  cursor: pointer;
  border: 1px solid #2B4C3D;
  border-radius: 5px;
  background: linear-gradient(#7EAA94, #52836B 48%, #45735D 52%, #3C6653);
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.4);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    inset 0 -1px 0 rgba(0, 0, 0, 0.28),
    0 1px 0 rgba(0, 0, 0, 0.36),
    0 2px 4px rgba(23, 25, 22, 0.26);
}
.okbtn::after {
  content: "";
  position: absolute;
  inset: 1px 1px auto 1px;
  height: 44%;
  border-radius: 4px 4px 7px 7px;
  background: linear-gradient(rgba(255,255,255,.4), rgba(255,255,255,.04));
  pointer-events: none;
}
.okbtn:hover { background: linear-gradient(#87B29C, #578872 48%, #4A7862 52%, #416B58); }
.okbtn:active {
  transform: translateY(1px);
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.42),
    inset 0 -1px 0 rgba(255, 255, 255, 0.12);
}
.okbtn:active::after { opacity: .5; }

/* 8e. Green glass */
.led {
  flex: none;
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 28%,
    #D6F8E3 0 11%, #74DBA2 34%, #35A46A 68%, #1C6642 100%);
  box-shadow:
    0 0 5px rgba(95, 208, 138, 0.85),
    inset 0 -1px 1px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(23, 25, 22, 0.2);
  animation: breathe 4.2s ease-in-out infinite;
}
.led--sm { width: 6px; height: 6px; }

.led.is-flicker { animation: flicker 340ms steps(1, end) 1; }

@keyframes breathe {
  0%, 100% { opacity: 1; }
  50%      { opacity: .62; }
}
@keyframes flicker {
  0%, 40%, 80% { opacity: .18; }
  20%, 60%, 100% { opacity: 1; }
}

/* -- 9. Colophon -------------------------------------------------------- */

.colophon {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: end;
  column-gap: clamp(20px, 4vw, 60px);
  row-gap: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
}

.colophon__name {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.colophon__mail {
  font-size: 13px;
  color: var(--jade-dark);
  text-decoration: none;
  box-shadow: inset 0 -1px 0 rgba(79, 127, 104, 0.42);
  transition: box-shadow 140ms ease;
}
.colophon__mail:hover { box-shadow: inset 0 -2px 0 var(--jade); }

.colophon__nav {
  display: flex;
  gap: 20px;
  justify-self: start;
  align-self: end;
}
.colophon__nav a {
  font-size: 13px;
  color: var(--ink-muted);
  text-decoration: none;
  box-shadow: inset 0 -1px 0 transparent;
  transition: color 140ms ease, box-shadow 140ms ease;
}
.colophon__nav a:hover {
  color: var(--ink);
  box-shadow: inset 0 -1px 0 var(--jade-soft);
}

.colophon__relics {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* 9a. Tiny rotating internet */
.globe { flex: none; }
.globe__spin ellipse,
.globe__fixed circle,
.globe__fixed path {
  fill: none;
  stroke: var(--jade-dark);
  stroke-width: 1.3;
}
.globe__spin ellipse {
  transform-box: fill-box;
  transform-origin: 50% 50%;
  animation: meridian 6s linear infinite;
}
.globe__spin ellipse:nth-child(2) { animation-delay: -1.5s; }
.globe.is-spin .globe__spin ellipse { animation-duration: 1.1s; }

@keyframes meridian {
  0%   { transform: scaleX(1); }
  25%  { transform: scaleX(.06); }
  50%  { transform: scaleX(1); }
  75%  { transform: scaleX(.06); }
  100% { transform: scaleX(1); }
}

/* 9b. A counter that counts nothing */
.counter {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.counter__label {
  font-family: var(--old);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.counter__digits {
  display: inline-flex;
  gap: 1px;
  padding: 2px;
  border: 1px solid #000;
  border-radius: 2px;
  background: #0C0F0B;
  box-shadow:
    inset 0 1px 3px rgba(0, 0, 0, 0.9),
    0 0 0 1px #C6C2B4;
}
.counter__digits b {
  padding: 2px 3px 3px;
  font-family: var(--old);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  color: var(--amber);
  background: linear-gradient(#1A1A14, #0A0A08);
  text-shadow: 0 0 4px rgba(255, 169, 43, 0.75);
}

.colophon__legal {
  grid-column: 1 / -1;
  margin-top: 6px;
  color: rgba(110, 113, 105, 0.8);
}

/* -- 9c. Privacy and Legal --------------------------------------------- */
/* Same palette, same type, no artefacts. These pages exist to be read. */

.page--doc { row-gap: clamp(40px, 6vh, 72px); }

.doc {
  max-width: 35rem;
  padding-bottom: clamp(20px, 5vh, 60px);
}

.doc__title {
  font-size: clamp(2.1rem, 5vw, 3rem);
  font-weight: 600;
  letter-spacing: -0.032em;
  line-height: 1;
}

.doc__meta { margin-top: 14px; color: var(--ink-muted); }

.doc__section { margin-top: clamp(32px, 4vw, 44px); }

.doc__section h2 {
  margin-bottom: 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--jade-dark);
}

.doc p,
.doc li {
  font-size: 1rem;
  line-height: 1.62;
  color: rgba(23, 25, 22, 0.84);
  text-wrap: pretty;
}

.doc__list {
  padding-left: 1.15em;
  list-style: none;
}
.doc__list li { position: relative; margin-bottom: 7px; }
.doc__list li::before {
  content: "";
  position: absolute;
  left: -1.05em;
  top: 0.66em;
  width: 5px; height: 1px;
  background: var(--jade-soft);
}

.doc__dl {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr);
  gap: 10px 18px;
}
.doc__dl > div { display: contents; }
.doc__dl dt {
  font-family: var(--old);
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-muted);
  padding-top: 5px;
}
.doc__dl dd {
  font-size: 1rem;
  line-height: 1.6;
  color: rgba(23, 25, 22, 0.84);
}

.doc__link {
  color: var(--jade-dark);
  text-decoration: none;
  box-shadow: inset 0 -1px 0 rgba(79, 127, 104, 0.45);
  transition: box-shadow 140ms ease, color 140ms ease;
}
.doc__link:hover {
  color: var(--ink);
  box-shadow: inset 0 -2px 0 var(--jade);
}

.doc__back {
  margin-top: clamp(38px, 5vw, 56px);
  padding-top: 22px;
  border-top: 1px solid var(--rule);
}

.colophon--doc { grid-template-columns: auto minmax(0, 1fr); }
.colophon--doc .colophon__nav { justify-self: end; }

/* -- 10. Laptop --------------------------------------------------------- */

@media (max-width: 1120px) {
  .artefact { width: 288px; }
  .hero { grid-column: 1 / 7; }
  .artefact-wrap { grid-column: 7 / 13; }
}

/* -- 11. Recompose for narrow viewports --------------------------------- */
/* Not a scaled-down desktop: the stack order, rhythm and rotation all change. */

@media (max-width: 920px) {
  :root { --base-rot: -1deg; }

  .page { row-gap: clamp(40px, 6vh, 64px); }
  .shell { width: min(640px, 100% - 11vw); }

  .stage {
    grid-template-columns: minmax(0, 1fr);
    row-gap: clamp(40px, 6vw, 56px);
    align-items: start;
    align-content: start;
    padding-block: clamp(8px, 2vh, 20px);
  }

  .hero,
  .artefact-wrap { grid-column: 1; }

  .artefact-wrap {
    justify-self: start;
    margin-right: 0;
    margin-top: 0;
    margin-left: 6px;
    max-width: 100%;
  }

  .artefact { width: min(312px, 100%); }

  .hero__title { font-size: clamp(2.75rem, 11vw, 4rem); }
  .hero__lead { max-width: 32ch; }

  .colophon {
    grid-template-columns: 1fr auto;
    row-gap: 26px;
  }
  .colophon__nav { justify-self: end; align-self: start; }
  .colophon__relics { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  .shell { width: calc(100% - 11vw); }

  .masthead { align-items: flex-start; }
  .sysbadge { padding-top: 4px; }

  .colophon,
  .colophon--doc {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }
  .colophon__nav,
  .colophon--doc .colophon__nav { justify-self: start; }
  .colophon__relics { flex-wrap: wrap; row-gap: 12px; }

  .doc__dl {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
  .doc__dl dt { padding-top: 14px; }
  .doc__dl dt:first-of-type { padding-top: 0; }
  .doc__dl dd { margin-top: 3px; }
}

/* Genuinely small phones — protect the note's internal rhythm */
@media (max-width: 380px) {
  :root { --base-rot: -0.7deg; }

  .artefact-wrap { margin-left: 2px; }
  .artefact__paper { padding-left: 30px; }
  .readout dd { font-size: 10px; }
  .readout dt { letter-spacing: 0.1em; }
  .counter__digits b { padding: 2px 2px 3px; }
  .colophon__relics { gap: 10px; }
}

/* -- 12. Reduced motion ------------------------------------------------- */
/* Every moving thing here is decorative. None of it carries information. */

@media (prefers-reduced-motion: reduce) {
  .led,
  .globe__spin ellipse {
    animation: none !important;
  }
  .globe__spin ellipse:first-of-type { transform: scaleX(.35); }
  .globe__spin ellipse:nth-child(2)  { transform: scaleX(.8); }

  .artefact { transform: rotate(var(--base-rot)); }

  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}

/* -- 13. Print ---------------------------------------------------------- */

@media print {
  .grain, .artefact-wrap, .colophon__relics { display: none; }
  .page { row-gap: 32px; }
  body { background: #FFF; }
}
