/* ==========================================================================
   strmcrown.dev

   Direction: parchment and oxidised copper. Monospace sets the structure
   (nav, labels, dates, record lines); a serif carries the prose. The machine
   labels the container, the human writes inside it.

   No shadows, no glows, no radii (bar the avatar), no icon fonts,
   no webfonts.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Tokens
   -------------------------------------------------------------------------- */

:root {
  color-scheme: light;

  --bg:      #f1eee5;  /* parchment */
  --bg-sub:  #e7e2d5;  /* code wells, quotes */
  --text:    #17150f;  /* ink */
  --muted:   #6a635a;
  --rule:    #d3cdbf;
  --accent:  #9c4a16;  /* burnt copper */

  --serif: Georgia, "Iowan Old Style", "Noto Serif", "Liberation Serif",
           "Times New Roman", serif;
  --mono:  ui-monospace, SFMono-Regular, "SF Mono", "JetBrains Mono",
           "Cascadia Mono", Menlo, Consolas, "DejaVu Sans Mono",
           "Liberation Mono", monospace;

  --measure: 41rem;   /* ~660px reading column */
  --label:   0.72rem;
  --track:   0.16em;  /* letter-spacing for labels */
}

/* System preference — the no-JS path. Skipped if light is pinned. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg:     #0d0d0b;  /* warm near-black, not blue-black */
    --bg-sub: #171612;
    --text:   #ddd7c9;
    --muted:  #8b8377;
    --rule:   #2b2823;
    --accent: #cf8642;  /* oxidised copper / amber phosphor */
  }
}

/* Explicit choice always wins. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg:     #0d0d0b;
  --bg-sub: #171612;
  --text:   #ddd7c9;
  --muted:  #8b8377;
  --rule:   #2b2823;
  --accent: #cf8642;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.72 var(--serif);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--accent);
  color: var(--bg);
}

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

img { max-width: 100%; height: auto; }

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 2.5rem 0;
}

/* Only the horizontal padding, as longhand: .container is combined with
   .hero and <main>, and a shorthand here would reset their vertical
   padding out from under them. */
.container {
  max-width: var(--measure);
  margin: 0 auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

main { padding-top: 2.5rem; }

/* --------------------------------------------------------------------------
   Type
   -------------------------------------------------------------------------- */

p { margin: 0 0 1.15em; }

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

a:hover { border-bottom-color: var(--accent); }

strong { font-weight: 700; }

code {
  font: 0.86em/1.5 var(--mono);
  background: var(--bg-sub);
  padding: 0.12em 0.35em;
}

pre {
  font: 0.84rem/1.6 var(--mono);
  background: var(--bg-sub);
  border-left: 2px solid var(--rule);
  padding: 1rem 1.1rem;
  overflow-x: auto;
}

pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

blockquote {
  margin: 1.6rem 0;
  padding-left: 1.2rem;
  border-left: 2px solid var(--rule);
  color: var(--muted);
  font-style: italic;
}

/* The one repeated device: a rule that carries its own label.
   Used for every structural boundary on the site. */
.labelled-rule {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin: 0 0 1.4rem;
  font: 400 var(--label)/1.4 var(--mono);
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--accent);
}

.labelled-rule::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.site-header {
  border-bottom: 1px solid var(--rule);
  padding: 2rem 0 0;
}

.masthead {
  display: flex;
  align-items: baseline;
  gap: 1rem;
}

.wordmark {
  font: 400 0.82rem/1 var(--mono);
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--accent);
  border-bottom: 0;
}

.wordmark:hover { color: var(--text); }

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.35rem;
  padding: 0.9rem 0 1rem;
}

.site-nav a {
  font: 400 0.78rem/1.6 var(--mono);
  letter-spacing: 0.03em;
  color: var(--muted);
  border-bottom: 1px solid transparent;
}

.site-nav a:hover { color: var(--text); }

.site-nav a.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.theme-toggle {
  margin-left: auto;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: var(--muted);
  font: 400 0.95rem/1 var(--mono);
}

.theme-toggle:hover { color: var(--accent); }

/* --------------------------------------------------------------------------
   Hero — home only
   -------------------------------------------------------------------------- */

.hero {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding-top: 3rem;
  padding-bottom: 2.25rem;
}

/* The source file is a rounded tile on a white plate, so a square crop
   leaves four white slivers in the corners. Clipped to a circle instead —
   the disc sits inside the white, so none of it survives the crop. */
.avatar {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  object-fit: cover;
  border: 1px solid var(--rule);
  border-radius: 50%;
}

.hero h1 {
  margin: 0 0 0.35rem;
  font: 400 1.7rem/1.15 var(--serif);
  letter-spacing: -0.01em;
}

.hero-subtitle {
  margin: 0;
  font: 400 var(--label)/1.5 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   Home
   -------------------------------------------------------------------------- */

.homepage-content p:first-child { margin-top: 0; }

.last-update {
  margin: 2.25rem 0;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  font: 400 var(--label)/1.6 var(--mono);
  letter-spacing: 0.03em;
  color: var(--muted);
}

.two-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  margin-top: 3rem;
}

.skills-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font: 400 0.82rem/1.5 var(--mono);
  color: var(--text);
}

/* --------------------------------------------------------------------------
   Section + list pages
   -------------------------------------------------------------------------- */

/* Section intros are muted, but the records inside .Content are not —
   hence the child combinator. */
.section-description > p { color: var(--muted); }

.section-description h2 {
  margin: 3rem 0 0.2rem;
  font: 700 1.25rem/1.3 var(--serif);
}

.section-description h3 {
  margin: 2rem 0 0.5rem;
  font: 700 1.05rem/1.35 var(--serif);
}

.post-list {
  list-style: none;
  margin: 2rem 0 0;
  padding: 0;
}

.post-list li {
  padding: 1.15rem 0;
  border-top: 1px solid var(--rule);
}

.post-list li:last-child { border-bottom: 1px solid var(--rule); }

.post-list h2 {
  margin: 0;
  font: 400 1.15rem/1.35 var(--serif);
}

.post-list a {
  color: var(--text);
  border-bottom: 0;
}

.post-list a:hover { color: var(--accent); }

.post-meta {
  margin-top: 0.4rem;
  font: 400 var(--label)/1.5 var(--mono);
  letter-spacing: 0.04em;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   Article
   -------------------------------------------------------------------------- */

.article-header {
  padding-bottom: 1.4rem;
  border-bottom: 1px solid var(--rule);
}

.article-header h1 {
  margin: 0 0 0.5rem;
  font: 400 1.85rem/1.2 var(--serif);
  letter-spacing: -0.01em;
}

.article-content { padding-top: 1.8rem; }

.article-content h2 {
  margin: 2.4rem 0 0.9rem;
  padding-top: 1.3rem;
  border-top: 1px solid var(--rule);
  font: 700 1.3rem/1.3 var(--serif);
}

.article-content h3 {
  margin: 2rem 0 0.7rem;
  font: 700 1.08rem/1.35 var(--serif);
}

.article-content ul,
.article-content ol { padding-left: 1.3rem; }

.article-content li { margin-bottom: 0.4rem; }

.article-content li::marker { color: var(--accent); }

.article-content img { display: block; margin: 1.8rem 0; }

.article-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  margin: 1.8rem 0;
}

.article-content th,
.article-content td {
  text-align: left;
  padding: 0.5rem 0.7rem 0.5rem 0;
  border-bottom: 1px solid var(--rule);
}

.article-content th {
  font: 400 var(--label)/1.5 var(--mono);
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--muted);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 0.6rem;
}

.tag {
  font: 400 var(--label)/1.5 var(--mono);
  letter-spacing: 0.04em;
  color: var(--muted);
  border-bottom: 0;
}

.tag::before { content: "#"; color: var(--rule); }

.tag:hover { color: var(--accent); }

.article-nav {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  margin-top: 3rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--rule);
  font: 400 var(--label)/1.5 var(--mono);
  letter-spacing: 0.03em;
}

.article-nav .next { margin-left: auto; text-align: right; }

/* --------------------------------------------------------------------------
   Records — projects, courses, contests, books
   Catalogue entries, not cards: hairline separated, flush left.
   -------------------------------------------------------------------------- */

.resources-grid,
.reading-columns {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin-top: 2rem;
}

.reading-columns { gap: 3rem; }

.resource-card,
.book-card {
  padding: 1.5rem 0;
  border-top: 1px solid var(--rule);
}

/* Not scoped to a parent: only some sections wrap their records in
   .resources-grid, the rest sit straight in .Content. */
.resource-card:last-child,
.book-card:last-child {
  border-bottom: 1px solid var(--rule);
}

.resource-card h3,
.book-header h3 {
  margin: 0 0 0.3rem;
  font: 400 1.12rem/1.35 var(--serif);
}

.book-author {
  margin: 0 0 0.8rem;
  font: 400 var(--label)/1.5 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Segmented meter: █ lit, ▒ unlit. Same ink for both — the shade glyph
   is half-density, so an unlit segment reads as unlit without needing a
   second colour. Letter-spacing keeps the blocks from fusing into one bar. */
.book-rating {
  margin-bottom: 0.8rem;
  font: 400 0.8rem/1 var(--mono);
  letter-spacing: 0.28em;
  color: var(--accent);
}

.book-review,
.resource-card p { margin-bottom: 0.9rem; }

.resource-card p:last-child,
.book-review:last-child { margin-bottom: 0; }

.resource-link {
  display: inline-block;
  font: 400 var(--label)/1.5 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer {
  margin-top: 5rem;
  padding: 1.2rem 0 3rem;
  border-top: 1px solid var(--rule);
  font: 400 var(--label)/1.6 var(--mono);
  letter-spacing: 0.04em;
  color: var(--muted);
}

.site-footer a { color: var(--muted); }

.site-footer a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 34rem) {
  body { font-size: 16px; }
  .two-columns { grid-template-columns: 1fr; gap: 2.25rem; }
  .hero { padding-top: 2.25rem; padding-bottom: 1.75rem; gap: 1rem; }
  .hero h1 { font-size: 1.45rem; }
  .site-nav { gap: 0.35rem 1rem; }
  .article-nav { flex-direction: column; }
  .article-nav .next { margin-left: 0; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
