/* --------------------------------------------
   Basic styles for Timeline cards
   Inspired by well-designed sites of the mid-1990s
----------------------------------------------- */

:root {
  view-transition-name: none;
}

body {
  font-family: 'Verdana', 'Geneva', sans-serif;
  background-color: light-dark(#c0bdb6, #1e1e2e);
  min-height: 100svh;
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 1px,
      light-dark(rgb(0 0 0 / 0.04), rgb(255 255 255 / 0.015)) 1px,
      light-dark(rgb(0 0 0 / 0.04), rgb(255 255 255 / 0.015)) 2px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 1px,
      light-dark(rgb(0 0 0 / 0.03), rgb(255 255 255 / 0.01)) 1px,
      light-dark(rgb(0 0 0 / 0.03), rgb(255 255 255 / 0.01)) 2px
    );
}

/* --------------------------------------------
   Site header
----------------------------------------------- */

.site-header {
  padding: 1rem calc(2vw + 1rem) 0.4rem;
  text-align: center;
  margin: 0;
}
h1 {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  font-weight: 700;
  margin: 0;
  line-height: 1.1;
  color: light-dark(#003366, #c8b888);
  text-shadow: 1px 1px 0 light-dark(rgb(255 255 255 / 0.5), rgb(0 0 0 / 0.4));
}
.tagline {
  font-size: 0.9rem;
  color: light-dark(#006666, #70a8a8);
  margin: 0.2rem 0 0;
  font-style: italic;
}
hr {
  border: none;
  border-top: 1px solid light-dark(#a09a90, #555);
  margin: 0.25rem auto;
  max-width: min(80%, 32rem);
}

/* --------------------------------------------
   Card styling
----------------------------------------------- */

article {
  margin: 0;
  border-radius: 0;
  overflow: hidden;
  background: light-dark(#ece8e0, #1a1a2e);
  border: 2px outset light-dark(#d0ccc4, #444466);
  padding: 0.75rem 1rem;
  box-shadow: inset 1px 1px 0 light-dark(rgb(255 255 255 / 0.6), rgb(255 255 255 / 0.05));
}
time {
  display: block;
  font-family: 'Courier New', 'Courier', monospace;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
  color: light-dark(#993333, #c07050);
  margin-bottom: 0.25rem;
  letter-spacing: 0.03em;
  text-shadow: 1px 1px 0 light-dark(rgb(0 0 0 / 0.15), rgb(0 0 0 / 0.4));
}
h2 {
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 700;
  font-size: 1rem;
  margin: 0 0 0.3rem;
  line-height: 1.3;
  color: light-dark(#003366, #c8b888);
  text-wrap: balance;
}
p {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.55;
  color: light-dark(#333, #999);
}

main {
  color: light-dark(#333, #bbb);
}

/* Featured cards — beveled accent, slightly darker background */
.featured {
  position: relative;
  border-left: 4px groove light-dark(#006666, #70a8a8);
  padding-left: calc(1rem - 2px);
  background: light-dark(#e4e0d8, #16162a);
}


/* --------------------------------------------
   Variations on the layout
----------------------------------------------- */

/* ---- Flexbox (horizontal scroll) ---- */
body:has(option[value="one"]:checked) {
  height: 100svh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  main {
    flex: 1;
    display: flex;
    flex-flow: column wrap;
    gap: 0.75rem;
    overflow-x: scroll;
    overflow-y: hidden;
    margin-block-end: 3lh;
  }
  article {
    flex: 0 0 auto;
    width: clamp(14rem, 25vw, 22rem);
  }
}

/* ---- Grid level 1 ---- */
body:has(option[value="two"]:checked) main {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  grid-template-rows: auto;
  gap: 0.75rem;
}
@media (max-width: 768px) {
  body:has(option[value="two"]:checked) main {
    grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  }
}

/* ---- Grid Lanes — Waterfall ---- */
body:has(option[value="three"]:checked) main {
  display: grid-lanes;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  gap: 0.75rem;
}
@media (max-width: 768px) {
  body:has(option[value="three"]:checked) main {
    grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  }
}
@supports not (display: grid-lanes) {
  body:has(option[value="three"]:checked) main {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
    grid-template-rows: auto;
  }
}

/* ---- Grid Lanes — Brick (horizontal scroll) ---- */
body:has(option[value="four"]:checked) {
  height: 100svh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  hr {
    flex-shrink: 0;
  }
  main {
    flex: 1;
    display: grid-lanes;
    grid-template-rows: repeat(4, minmax(6em, 1fr));
    gap: 0.75rem;
    overflow-x: scroll;
    overflow-y: hidden;
    padding-block: 0 1rem;
  }
  article {
    display: block;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    width: max-content;
    max-width: min(40ch, 75vw);
  }
  article:last-child {
    margin-inline-end: 2rem;
  }
  .featured {
    grid-row: span 2;
    &::after {
      position: absolute;
      bottom: 0.5rem;
      left: 1rem;
      margin: 0;
    }
  }
  time {
    font-size: 1.3rem;
    margin-bottom: 0.15rem;
  }
  article h2 {
    font-size: 0.85rem;
    text-wrap: balance;
  }
  article p {
    margin: 0;
    font-size: 0.75rem;
  }
}
@supports not (display: grid-lanes) {
  body:has(option[value="four"]:checked) main {
    display: flex;
    flex-flow: row wrap;
    max-height: 80vh;
  }
}
@media (max-width: 500px) {
  body:has(option[value="four"]:checked) {
    article {
      min-width: 12rem;
    }
    time {
      font-size: 1.1rem;
    }
  }
}

/* ---- Grid Lanes — Brick + Popovers (anchor positioned) ---- */
body:has(option[value="five"]:checked) {
  main {
    display: grid-lanes;
    grid-template-rows: repeat(4, 1fr);
    gap: 0.75rem;
    overflow-x: scroll;
  }
  article:last-child {
    margin-inline-end: 2rem;
  }
  article {
    width: max-content;
    cursor: pointer;
  }
  .featured {
    grid-row: span 2;
    &::after {
      position: absolute;
      bottom: 0.5rem;
      left: 1rem;
      margin: 0;
    }
  }
  time {
    font-size: 1.3rem;
    margin-bottom: 0.15rem;
  }
  article h2 {
    font-size: 0.85rem;
    text-wrap: balance;
  }
  article p {
    display: none;
  }
}
@supports not (display: grid-lanes) {
  body:has(option[value="five"]:checked) main {
    display: flex;
    flex-flow: row wrap;
    max-height: 80vh;
  }
}
@media (max-width: 500px) {
  body:has(option[value="five"]:checked) {
    main {
      grid-template-rows: repeat(4, 1fr);
    }
    article {
      width: auto;
      min-width: 12rem;
    }
    time {
      font-size: 1.1rem;
    }
  }
}

/* ---- Grid Lanes — Brick (h2 only) ---- */
body:has(option[value="six"]:checked) {
  main {
    display: grid-lanes;
    grid-template-rows: repeat(4, 1fr);
    gap: 0.75rem;
    overflow-x: scroll;
  }
  article:last-child {
    margin-inline-end: 2rem;
  }
  article {
    width: max-content;
  }
  .featured {
    grid-row: span 2;
    &::after {
      position: absolute;
      bottom: 0.5rem;
      left: 1rem;
      margin: 0;
    }
  }
  time {
    font-size: 1.3rem;
    margin-bottom: 0.15rem;
  }
  article h2 {
    font-size: 0.85rem;
    text-wrap: balance;
  }
}
@supports not (display: grid-lanes) {
  body:has(option[value="six"]:checked) main {
    display: flex;
    flex-flow: row wrap;
    max-height: 80vh;
  }
}
@media (max-width: 500px) {
  body:has(option[value="six"]:checked) {
    article {
      width: auto;
      min-width: 12rem;
    }
    time {
      font-size: 1.1rem;
    }
  }
}

/* Anchor-positioned card popovers */
.card-popover {
  position: fixed;
  position-area: bottom;
  position-try-fallbacks: flip-block;
  width: anchor-size(width);
  margin: 0;
  padding: 0.75rem 1rem;
  border: 2px outset light-dark(#d0ccc4, #444466);
  background: light-dark(#f5f2eb, #1a1a2e);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  &::backdrop {
    background: transparent;
  }
  p {
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.55;
    color: light-dark(#333, #999);
  }
}


/* --------------------------------------------
   Counters marking items (when enabled)
----------------------------------------------- */

body {
  counter-reset: item-counter 0;
}
article {
  position: relative;
  counter-increment: item-counter;
}
body:has(input[type="checkbox"]:checked) {
  article::before,
  article::after,
  .featured::before,
  .featured::after {
    position: absolute;
    top: 0;
    right: 0;
    bottom: auto;
    left: auto;
    margin: 0;
    padding: 0.1em 0.5em 0.3em;
    min-width: 2ch;
    text-align: right;
  }
  article::after,
  .featured::after {
    counter-increment: counter(item-counter);
    content: counter(item-counter);
    background: rgba(65, 83, 47, 0.65);
    color: white;
    font-family: var(--font-text);
    font-size: 2rem;
    font-weight: 400;
  }
  article::before,
  .featured::before {
    content: counter(item-counter);
    color: white;
    font-family: var(--font-text);
    font-size: 2rem;
    font-weight: 400;
  }
}


/* Theme-aware counters */
body:has(option[value="colorful"]:checked):has(input[type="checkbox"]:checked) {
  article::after {
    background: light-dark(#6030a0, #1e1830);
    color: light-dark(#fff, #c0a0e0);
  }
}
body:has(option[value="modern"]:checked):has(input[type="checkbox"]:checked) {
  article::after {
    background: light-dark(#4f46e5, #312e81);
    color: light-dark(#fff, #c7d2fe);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-weight: 600;
  }
  article::before {
    color: white;
  }
}
body:has(option[value="webmaster"]:checked):has(input[type="checkbox"]:checked) {
  article::after {
    background: #000080;
    color: #00ffff;
    font-family: 'Comic Sans MS', 'Chalkboard', cursive;
  }
  article::before {
    color: #ffff00;
  }
}

/* ============================================
   THEME VARIATIONS
   Switched via :has() on the theme <select>
============================================ */

/* ---- Theme: Classic (1995 web) ----
   Flat blue-grey desktop, white "table cell" cards with
   thin black borders, classic blue underlined <a> links.
   System fonts only — Times, Arial, Georgia — and we lean
   into the faux italic / faux bold rendering of an era
   when browsers slanted and thickened text algorithmically. */
html:has(option[value="classic"]:checked) {
  background-color: light-dark(#c4ccd4, #1d2128);
}
body:has(option[value="classic"]:checked) {
  font-family: 'Times New Roman', Times, serif;
  background-color: light-dark(#c4ccd4, #1d2128);
  background-image: none;
  color: light-dark(#1a1a1a, #d4d8e0);

  h1 {
    font-family: Georgia, 'Times New Roman', serif;
    font-style: oblique 14deg;
    font-synthesis: style weight;
    color: light-dark(#1a3a6e, #9aa8c8);
    text-shadow: none;
  }
  .tagline {
    font-family: 'Times New Roman', Times, serif;
    font-style: oblique 16deg;
    font-synthesis: style;
    font-size: 1rem;
    color: light-dark(#6b1a1a, #d08868);
    &::before { content: "\2014 \00a0"; }
    &::after { content: "\00a0\2014"; }
  }
  hr {
    border: none;
    border-top: 1px solid light-dark(#7a808a, #5a606a);
    margin: 0 auto;
    max-width: min(80%, 32rem);
  }

  /* Default unstyled <a>: blue, purple visited, underlined. */
  main a, .card-popover a {
    color: light-dark(#0000ee, #7090ee);
    text-decoration: underline;
    &:visited {
      color: light-dark(#551a8b, #a080d0);
    }
    &:active {
      color: light-dark(#ee0000, #ff8080);
    }
  }

  article {
    background: light-dark(#ffffff, #2a2f38);
    border: 1px solid light-dark(#404040, #5a606a);
    box-shadow: none;
    font-family: 'Times New Roman', Times, serif;
  }
  time {
    font-family: Arial, Helvetica, sans-serif;
    font-style: oblique 14deg;
    font-synthesis: style;
    font-weight: 700;
    font-size: 1.5rem;
    line-height: 1;
    color: light-dark(#6b1a1a, #d08868);
    letter-spacing: 0;
    text-shadow: none;
  }
  article h2 {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    color: light-dark(#1a3a6e, #9aa8c8);
    /* Faux "extra thick" — stroke + offset shadow on top of real bold. */
    text-shadow: 0.5px 0 0 currentColor;
  }
  article p {
    font-family: 'Times New Roman', Times, serif;
    font-size: 1rem;
    line-height: 1.5;
    color: light-dark(#1a1a1a, #d4d8e0);
  }

  .featured {
    border-left: 6px double light-dark(#6b1a1a, #d08868);
    background: light-dark(#fffce0, #2e2f3c);
    padding-left: calc(1rem - 5px);
  }

  .card-popover {
    background: light-dark(#ffffff, #2a2f38);
    border: 1px solid light-dark(#404040, #5a606a);
    box-shadow: 2px 2px 0 light-dark(rgb(0 0 0 / 0.25), rgb(0 0 0 / 0.5));
    p {
      font-family: 'Times New Roman', Times, serif;
      color: light-dark(#1a1a1a, #d4d8e0);
    }
  }
}

/* ---- Theme: Colorful ---- */
body:has(option[value="colorful"]:checked) {
  background-color: light-dark(#e8e4f0, #1a1028);
  background-image:
    radial-gradient(ellipse at 20% 50%, light-dark(rgb(224 96 64 / 0.08), rgb(224 96 64 / 0.06)) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 30%, light-dark(rgb(32 152 176 / 0.08), rgb(32 152 176 / 0.06)) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, light-dark(rgb(128 80 192 / 0.06), rgb(128 80 192 / 0.05)) 0%, transparent 50%);

  article {
    background: light-dark(#fff, #1e1830);
    border: 2px solid;
    box-shadow: none;
  }
  article:nth-child(5n+1) { border-color: light-dark(#e06040, #c04830); }
  article:nth-child(5n+2) { border-color: light-dark(#2098b0, #1880a0); }
  article:nth-child(5n+3) { border-color: light-dark(#d0a020, #b08818); }
  article:nth-child(5n+4) { border-color: light-dark(#8050c0, #7040a0); }
  article:nth-child(5n+5) { border-color: light-dark(#30a060, #208848); }

  time {
    text-shadow: none;
  }
  article:nth-child(5n+1) time { color: light-dark(#c83820, #e06040); }
  article:nth-child(5n+2) time { color: light-dark(#107898, #30b0d0); }
  article:nth-child(5n+3) time { color: light-dark(#a07808, #d0a828); }
  article:nth-child(5n+4) time { color: light-dark(#6030a0, #a070d0); }
  article:nth-child(5n+5) time { color: light-dark(#187838, #40c070); }

  h1 {
    color: light-dark(#6030a0, #c0a0e0);
    text-shadow: none;
  }
  h2 { color: light-dark(#222, #e0d8f0); }
  p { color: light-dark(#444, #aaa); }
  .tagline { color: light-dark(#e06040, #e08060); }
  hr { border-top: 3px solid light-dark(#d0a020, #b08818); }

  .featured {
    border-left: 4px solid light-dark(#d0a020, #d0a020);
    background: light-dark(#fdf8ee, #1e1830);
  }

  .card-popover {
    background: light-dark(#fff, #1e1830);
    border: 2px solid light-dark(#8050c0, #7040a0);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    p { color: light-dark(#444, #aaa); }
  }
}

/* ---- Theme: Webmaster Special ----
   The proud personal homepage of 1996: tiled starfield,
   Comic Sans + animated rainbow type, magenta/cyan/yellow
   neon, marquee tagline, scrolling rainbow rule,
   "UNDER CONSTRUCTION" tape, and sparkle bullets. */
html:has(option[value="webmaster"]:checked) {
  background-color: #000040;
}
body:has(option[value="webmaster"]:checked) {
  background-color: #000040;
  background-image:
    radial-gradient(1.5px 1.5px at 20px 30px, #ffff00, transparent),
    radial-gradient(1px 1px at 40px 70px, #ff00ff, transparent),
    radial-gradient(1.5px 1.5px at 90px 40px, #00ffff, transparent),
    radial-gradient(1px 1px at 130px 80px, #fff, transparent),
    radial-gradient(2px 2px at 160px 20px, #ff00ff, transparent),
    radial-gradient(1.5px 1.5px at 60px 90px, #ffff00, transparent),
    radial-gradient(1px 1px at 110px 60px, #00ffff, transparent),
    radial-gradient(2px 2px at 180px 50px, #fff, transparent);
  background-size: 200px 100px;
  color: #ffff00;
  font-family: 'Comic Sans MS', 'Chalkboard', cursive;

  h1 {
    font-family: 'Comic Sans MS', 'Chalkboard', cursive;
    color: #ff00ff;
    text-shadow:
      2px 2px 0 #00ffff,
      -2px -2px 0 #ffff00,
      0 0 14px rgba(255, 0, 255, 0.6);
    animation: webmaster-rainbow 3s linear infinite;
  }
  @keyframes webmaster-rainbow {
    0%   { color: #ff00ff; }
    33%  { color: #00ffff; }
    66%  { color: #ffff00; }
    100% { color: #ff00ff; }
  }
  .tagline {
    font-family: 'Comic Sans MS', 'Chalkboard', cursive;
    font-style: normal;
    color: #00ff00;
    overflow: hidden;
    white-space: nowrap;
    animation: webmaster-marquee 14s linear infinite;
    &::before { content: ""; }
    &::after { content: ""; }
  }
  @keyframes webmaster-marquee {
    0%   { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
  }
  hr {
    height: 4px;
    border: none;
    background: linear-gradient(90deg,
      #ff0000, #ff8800, #ffff00, #00ff00,
      #00aaff, #6600ff, #ff00ff, #ff0000);
    background-size: 200% 100%;
    margin: 0;
    max-width: 100%;
    animation: webmaster-rainbow-scroll 3s linear infinite;
  }
  @keyframes webmaster-rainbow-scroll {
    0%   { background-position: 0 0; }
    100% { background-position: 200% 0; }
  }

  /* Bright yellow underlined links — visited magenta, hover cyan. */
  main a, .card-popover a {
    color: #ffff00;
    text-decoration: underline;
    &:visited { color: #ff80ff; }
    &:hover   { color: #00ffff; }
  }

  article {
    background: #000080;
    border: 3px ridge #80c0ff;
    box-shadow: 0 0 8px rgba(255, 0, 255, 0.25);
    font-family: 'Comic Sans MS', 'Chalkboard', cursive;
  }
  time {
    font-family: 'Comic Sans MS', 'Chalkboard', cursive;
    font-style: normal;
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: 0;
    color: #00ffff;
    text-shadow: 2px 2px 0 #000;
    &::before { content: "\2728 "; }
  }
  article h2 {
    font-family: 'Comic Sans MS', 'Chalkboard', cursive;
    color: #ffff00;
    font-size: 1.05rem;
    text-shadow: 1px 1px 0 #000;
  }
  article p {
    font-family: 'Comic Sans MS', 'Chalkboard', cursive;
    color: #c0c0ff;
    font-size: 0.9rem;
  }

  .featured {
    border-left: 4px solid #ff00ff;
    background: #1a0050;
    &::after {
      content: "\1F477";
      position: absolute;
      top: 0.35rem;
      right: 0.5rem;
      font-size: 1.5rem;
      line-height: 1;
      animation: webmaster-dig 0.5s steps(2) infinite;
      pointer-events: none;
    }
  }
  @keyframes webmaster-dig {
    0%   { transform: rotate(-14deg); }
    100% { transform: rotate(14deg); }
  }

  .card-popover {
    background: #000080;
    border: 3px ridge #80c0ff;
    box-shadow: 0 0 16px rgba(255, 0, 255, 0.4);
    p {
      font-family: 'Comic Sans MS', 'Chalkboard', cursive;
      color: #c0c0ff;
    }
  }
}

/* ---- Theme: Modern ----
   The generic 2024 SaaS aesthetic: system fonts, soft borders,
   subtle shadows, an indigo accent, full light/dark support. */
body:has(option[value="modern"]:checked) {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background-color: light-dark(#fafafa, #0a0a0a);
  background-image: none;
  color: light-dark(#27272a, #e4e4e7);

  h1 {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: light-dark(#18181b, #fafafa);
    font-weight: 700;
    letter-spacing: -0.02em;
    text-shadow: none;
  }
  .tagline {
    color: light-dark(#71717a, #a1a1aa);
    font-style: normal;
    font-weight: 400;
  }
  hr {
    border-top: 1px solid light-dark(#e4e4e7, #27272a);
  }

  main a, .card-popover a {
    color: light-dark(#4f46e5, #818cf8);
    text-decoration: none;
    &:hover { text-decoration: underline; }
  }

  article {
    background: light-dark(#ffffff, #18181b);
    border: 1px solid light-dark(#e4e4e7, #27272a);
    border-radius: 10px;
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.04);
  }
  time {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-weight: 600;
    font-size: 0.8rem;
    line-height: 1.2;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: light-dark(#4f46e5, #818cf8);
    text-shadow: none;
  }
  article h2 {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-weight: 600;
    font-size: 1rem;
    color: light-dark(#18181b, #fafafa);
    text-shadow: none;
  }
  article p {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: light-dark(#52525b, #a1a1aa);
    font-size: 0.85rem;
    line-height: 1.55;
  }

  .featured {
    border-left: 3px solid light-dark(#4f46e5, #818cf8);
    background: light-dark(#f4f4f5, #1f1f23);
    padding-left: calc(1rem - 2px);
  }

  .card-popover {
    background: light-dark(#ffffff, #18181b);
    border: 1px solid light-dark(#e4e4e7, #27272a);
    border-radius: 10px;
    box-shadow: 0 10px 25px rgb(0 0 0 / 0.1);
    p {
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      color: light-dark(#52525b, #a1a1aa);
    }
  }
}
