/* ---------------------------------------------------------------
   Linux 35 — riso-print brochure style.
   Two inks on cream paper: forest green + beak orange.
   Zero dependencies. Learnable bits:
   - light-dark() + color-scheme theming
   - CSS scroll-driven animations (view()/scroll())
   - CSS mask: any SVG becomes screen-printed ink
   --------------------------------------------------------------- */

:root {
  color-scheme: light dark;

  /* the two inks + paper */
  --paper: light-dark(oklch(0.945 0.028 88), oklch(0.24 0.035 165));
  --paper-raised: light-dark(oklch(0.97 0.02 88), oklch(0.29 0.038 165));
  --ink: light-dark(oklch(0.38 0.085 160), oklch(0.93 0.03 88));
  --ink-soft: light-dark(oklch(0.45 0.07 160), oklch(0.82 0.03 90));
  --green: oklch(0.42 0.085 158);
  --green-deep: oklch(0.34 0.075 160);
  --orange: oklch(0.66 0.165 45);
  --orange-deep: oklch(0.58 0.16 42);
  --cream: oklch(0.945 0.028 88);
  --rule: light-dark(oklch(0.38 0.085 160 / 0.22), oklch(0.93 0.03 88 / 0.22));

  --font-display: "Chango", "Ubuntu", system-ui, sans-serif;
  --font-body: "Ubuntu", "DejaVu Sans", system-ui, sans-serif;
  --font-mono: "Ubuntu Mono", "DejaVu Sans Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
}

a { color: var(--orange-deep); text-underline-offset: 3px; }
a:hover { color: var(--orange); }

:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 3px;
  border-radius: 2px;
}

/* screen-printed icon: any SVG silhouette, painted in ink */
.stamp {
  display: inline-block;
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

/* sticker chip: full-color icon on a paper tab */
.chip {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  background: var(--cream);
  border: 2px solid var(--green-deep);
  border-radius: 12px;
  flex: none;
}
.chip img { width: 68%; height: 68%; object-fit: contain; display: block; }
.chip.big { width: 62px; height: 62px; border-radius: 16px; }
.fact .chip { border-color: var(--orange-deep); background: oklch(0.985 0.012 88); }

/* halftone dot texture for ink blocks */
.ink-block {
  position: relative;
}
.ink-block::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(oklch(1 0 0 / 0.07) 1px, transparent 1.5px);
  background-size: 7px 7px;
}
.ink-block > * { position: relative; z-index: 1; }

/* wavy paper-cut edges between panels */
.wave { display: block; width: 100%; height: 44px; }

/* display type */
.display {
  font-family: var(--font-display);
  font-weight: 400;
  text-transform: uppercase;
  line-height: 1.02;
  letter-spacing: 0.01em;
}

/* ---- reading progress ---- */
.progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 5px;
  background: var(--orange);
  transform-origin: 0 50%;
  transform: scaleX(0);
  z-index: 10;
}
@supports (animation-timeline: scroll()) {
  .progress { animation: grow linear both; animation-timeline: scroll(); }
}
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---- header ---- */
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 3rem);
  font-family: var(--font-mono);
  font-size: 0.9rem;
}
.top .host { color: var(--ink-soft); }
.top .host b { color: var(--orange-deep); font-weight: 700; }

#theme-toggle {
  font: inherit;
  color: var(--ink);
  background: none;
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
  cursor: pointer;
}
#theme-toggle:hover { color: var(--orange-deep); border-color: var(--orange-deep); }

/* ---- hero ---- */
.hero {
  padding: clamp(1.5rem, 5vw, 4rem) clamp(1rem, 4vw, 3rem) clamp(2.5rem, 6vw, 5rem);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
  max-width: 74rem;
  margin-inline: auto;
}

.bootlog {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--ink-soft);
  margin: 0 0 1.4rem;
  min-height: 4.5em;
}
.bootlog .ok { color: var(--orange-deep); font-weight: 700; }
.bootlog div { opacity: 0; animation: bootline 0.01s both; }
.bootlog div:nth-child(1) { animation-delay: 0.15s; }
.bootlog div:nth-child(2) { animation-delay: 0.55s; }
.bootlog div:nth-child(3) { animation-delay: 0.95s; }
@keyframes bootline { to { opacity: 1; } }

.hero h1 {
  font-size: clamp(3.2rem, 10vw, 7rem);
  margin: 0 0 1.2rem;
}
.hero h1 span { display: block; }
.hero h1 .l2 { color: var(--orange); }
.hero h1 .l3 { color: var(--ink); }
.hero h1 .l3 em { font-style: normal; color: var(--orange); }

.hero .sub {
  max-width: 42ch;
  color: var(--ink-soft);
  margin: 0;
  font-size: 1.15rem;
}

/* orange poster panel holding Tux */
.hero-panel {
  background: var(--orange);
  border-radius: 22px;
  padding: clamp(1.5rem, 3vw, 2.5rem);
  display: grid;
  justify-items: center;
  gap: 1.2rem;
  transform: rotate(1.5deg);
}
.hero-panel .tux { width: min(100%, 260px); }
.hero-panel .stamp-row { display: flex; gap: 0.8rem; }
.hero-panel .chip { border-color: var(--orange-deep); }
.hero-panel .caption {
  font-family: var(--font-mono);
  color: var(--cream);
  font-size: 0.85rem;
  margin: 0;
  text-align: center;
}

/* ---- green panel: the 1991 post ---- */
.panel-green { background: var(--green); color: var(--cream); }
.panel-green a { color: var(--cream); }
.panel-green .inner {
  max-width: 50rem;
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 4rem) clamp(1rem, 4vw, 3rem) clamp(3rem, 6vw, 5rem);
}
.panel-head { display: flex; align-items: center; gap: 1.2rem; margin-bottom: 1.6rem; }
.panel-head .stamp { width: 56px; height: 56px; flex: none; }
.panel-head h2 { font-size: clamp(1.8rem, 5vw, 3rem); margin: 0; }

.msg {
  background: var(--cream);
  color: var(--green-deep);
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  line-height: 1.55;
  overflow-x: auto;
  box-shadow: 6px 6px 0 var(--green-deep);
  transform: rotate(-0.6deg);
}
.msg-headers {
  padding: 0.9rem 1.2rem;
  border-bottom: 2px dashed oklch(0.42 0.085 158 / 0.35);
  white-space: pre;
}
.msg-headers b { font-weight: 700; }
.msg-body { padding: 1.1rem 1.2rem; white-space: pre-wrap; margin: 0; }
.msg-body .hobby { background: oklch(0.66 0.165 45 / 0.3); padding: 0 0.15em; }
.msg-caption { font-family: var(--font-mono); font-size: 0.85rem; margin: 1rem 0 0; opacity: 0.85; }

/* ---- timeline ---- */
.timeline-section {
  max-width: 74rem;
  margin-inline: auto;
  padding: clamp(2.5rem, 5vw, 4rem) clamp(1rem, 4vw, 3rem) clamp(3rem, 6vw, 5rem);
  /* the terminal's typing is driven by this section's trip through the viewport */
  view-timeline: --kernel-log block;
}
.timeline-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: clamp(1.5rem, 3vw, 3rem);
  align-items: start;
}
.timeline-section .section-head { margin-bottom: 2.5rem; max-width: 46rem; }
.eyebrow {
  font-family: var(--font-mono);
  color: var(--orange-deep);
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  margin: 0 0 0.4rem;
}
.timeline-section h2 { font-size: clamp(2rem, 5vw, 3.2rem); margin: 0 0 0.6rem; color: var(--ink); }
.timeline-section .section-head p { color: var(--ink-soft); margin: 0; max-width: 62ch; }

.timeline {
  max-width: 50rem;
  display: grid;
  gap: 1.1rem;
  position: relative;
}

milestone-card { display: block; }

@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    milestone-card {
      animation: card-in linear both;
      animation-timeline: view();
      animation-range: entry 5% entry 45%;
    }
  }
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(28px) rotate(0.5deg); }
  to   { opacity: 1; transform: none; }
}

/* ---- the scrolling terminal ---- */
.terminal {
  position: sticky;
  top: 4.5rem;
  transform: rotate(1deg);
  border: 2px solid var(--green-deep);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 6px 6px 0 var(--rule);
  background: oklch(0.21 0.04 165);
}
.term-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--green-deep);
  color: var(--cream);
  padding: 0.5rem 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}
.term-bar span { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.term-bar span:nth-child(1) { background: var(--orange); }
.term-bar span:nth-child(2) { background: var(--cream); opacity: 0.65; }
.term-bar span:nth-child(3) { background: oklch(0.75 0.14 150); }
.term-bar em { font-style: normal; margin-left: 0.4rem; opacity: 0.85; }
.term-screen {
  padding: 1rem 1.1rem 1.3rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.75;
  color: oklch(0.88 0.045 145);
  min-height: 25em;
}
.term-line { white-space: pre-wrap; }
.term-line i { font-style: normal; color: var(--orange); font-weight: 700; }
.term-line b { color: var(--cream); font-weight: 700; }
.caret {
  display: inline-block;
  width: 0.55em;
  height: 1.05em;
  margin-left: 3px;
  background: var(--orange);
  vertical-align: text-bottom;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* each line "types itself" as the timeline section scrolls past */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .term-line {
      opacity: 0;
      animation: term-type linear both;
      animation-timeline: --kernel-log;
      animation-range: contain calc(var(--i) * 5.5%) contain calc(var(--i) * 5.5% + 4%);
    }
  }
}
@keyframes term-type {
  from { opacity: 1; clip-path: inset(0 100% 0 0); }
  to   { opacity: 1; clip-path: inset(0 -5% 0 0); }
}

/* mobile-only inline terminal snippets between milestones */
.term-snippet {
  border: 2px solid var(--green-deep);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 5px 5px 0 var(--rule);
  background: oklch(0.21 0.04 165);
  transform: rotate(-0.6deg);
  margin-block: 0.4rem;
}
.snippet-screen {
  padding: 0.7rem 1rem 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.7;
  color: oklch(0.88 0.045 145);
}
.snippet-screen .term-line { opacity: 1; animation: none; }
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .term-snippet {
      animation: card-in linear both;
      animation-timeline: view();
      animation-range: entry 5% entry 45%;
    }
  }
}

@media (min-width: 901px) {
  .term-snippet { display: none; }
}
@media (max-width: 900px) {
  .timeline-wrap { grid-template-columns: 1fr; }
  .terminal { display: none; }
}

/* ---- fun facts: orange panel ---- */
.panel-orange { background: var(--orange); color: var(--cream); }
.panel-orange .inner {
  max-width: 74rem;
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 4rem) clamp(1rem, 4vw, 3rem) clamp(3rem, 6vw, 5rem);
}
.panel-orange .panel-head h2 { color: var(--cream); }
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.2rem;
  margin-top: 2rem;
}
.fact {
  background: var(--cream);
  color: var(--green-deep);
  border-radius: 12px;
  padding: 1.3rem 1.3rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  box-shadow: 5px 5px 0 var(--orange-deep);
}
.fact:nth-child(odd) { transform: rotate(-0.8deg); }
.fact:nth-child(even) { transform: rotate(0.7deg); }
.fact .stamp { width: 42px; height: 42px; color: var(--orange-deep); }
.fact h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  text-transform: uppercase;
  font-size: 1.05rem;
  line-height: 1.15;
}
.fact p { margin: 0; font-size: 0.93rem; line-height: 1.5; flex: 1; }
.fact a { font-family: var(--font-mono); font-size: 0.8rem; color: var(--green); }
.fact a:hover { color: var(--orange-deep); }

/* ---- footer: green panel ---- */
.panel-footer { background: var(--green-deep); color: var(--cream); font-size: 0.9rem; }
.panel-footer a { color: var(--cream); }
.panel-footer .inner {
  max-width: 74rem;
  margin-inline: auto;
  padding: 2.5rem clamp(1rem, 4vw, 3rem) 3.5rem;
  display: grid;
  gap: 0.7rem;
}
.panel-footer .stamp { width: 30px; height: 30px; }
.panel-footer .colophon { font-family: var(--font-mono); font-size: 0.82rem; opacity: 0.85; }

/* ---- responsive ---- */
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; }
  .hero-panel { transform: none; max-width: 24rem; justify-self: center; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .bootlog div { animation: none; opacity: 1; }
}

::view-transition-old(root), ::view-transition-new(root) {
  animation-duration: 0.35s;
}
