/* ==========================================================================
   IndieWeb — Warm Terminal theme for lucaguidi.com
   Palette, type and spacing translated from the redesign spec.
   Responsive by design: fluid type (clamp), rem sizing, flex-wrap,
   auto-fit grids. Light + dark via [data-theme] on <html>.
   ========================================================================== */

/* ---- Palette -------------------------------------------------------------
   --lga (accent) is injected from site params in <head> so it stays
   configurable; a fallback is provided here too.                          */
:root {
  --bg:   #f5f1e6;   /* page background        */
  --ink:  #2b2a25;   /* primary text           */
  --sub:  #54503f;   /* secondary text         */
  --txt:  #3d3a30;   /* body prose             */
  --nav:  #6b6659;   /* inactive nav           */
  --mut:  #8a8370;   /* muted / meta           */
  --fnt:  #a89f88;   /* faint / footnotes      */
  --line: #c9c0a8;   /* dashed & dotted rules  */
  --chip: #ebe5d3;   /* inline code chip       */
  --lga:  #c77c2c;   /* accent (amber)         */

  /* syntax highlight (Chroma) — light */
  --code-bg:      #efe9d8;
  --code-fg:      #3d3a30;
  --code-comment: #8a8370;
  --code-keyword: #b5602a;
  --code-string:  #5f7a3a;
  --code-number:  #9a6b1e;
  --code-name:    #2b2a25;
  --code-func:    #2c6d7a;
  --code-line:    rgba(0,0,0,.045);
}

[data-theme="dark"] {
  --bg:   #201f1a;
  --ink:  #eae5d7;
  --sub:  #b5ae9a;
  --txt:  #ccc6b4;
  --nav:  #938c78;
  --mut:  #807a66;
  --fnt:  #6e6853;
  --line: #4c4839;
  --chip: #343228;
  --lga:  #e09a4f;

  --code-bg:      #2a2822;
  --code-fg:      #ccc6b4;
  --code-comment: #7d7660;
  --code-keyword: #e09a4f;
  --code-string:  #a9c07e;
  --code-number:  #d6a55a;
  --code-name:    #eae5d7;
  --code-func:    #7fbccb;
  --code-line:    rgba(255,255,255,.05);
}

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

html {
  -webkit-text-size-adjust: 100%;   /* respect user font-size, don't inflate */
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 100%;                  /* honours browser / user base size */
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .2s ease, color .2s ease;
}

a { color: var(--lga); text-decoration: none; }
a:hover { color: var(--ink); }

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

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

/* Accessible focus ring for keyboard users */
a:focus-visible,
button:focus-visible,
.nav a:focus-visible {
  outline: 2px solid var(--lga);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---- Layout shell -------------------------------------------------------- */
.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: clamp(32px, 6vw, 56px) clamp(20px, 5vw, 36px) 48px;
  flex: 1 0 auto;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--lga);
  color: var(--bg);
  padding: 8px 14px;
  z-index: 10;
}
.skip-link:focus { left: 8px; top: 8px; }

/* ---- Masthead / nav ------------------------------------------------------ */
.masthead {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px 18px;
  font-size: 0.8125rem;
}

.masthead__brand { font-weight: 600; color: var(--ink); }
.masthead__brand:hover { color: var(--lga); }

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 22px;
  color: var(--nav);
}
.nav a { color: var(--nav); }
.nav a:hover { color: var(--ink); }
.nav a.is-active {
  color: var(--ink);
  border-bottom: 2px solid var(--lga);
  padding-bottom: 2px;
}

.nav__toggle {
  font: inherit;
  color: var(--lga);
  font-weight: 600;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  line-height: 1;
}
.nav__toggle:hover { color: var(--ink); }

/* ---- Home splash --------------------------------------------------------- */
.splash { margin-top: 64px; }

.splash__name {
  font-size: clamp(2rem, 7.5vw, 2.625rem);
  font-weight: 600;
  letter-spacing: -0.5px;
  line-height: 1.1;
  margin: 0;
  color: var(--ink);
}

.cursor {
  display: inline-block;
  width: .45em;
  height: .85em;
  background: var(--lga);
  margin-left: .25em;
  vertical-align: -.06em;
  animation: lgblink 1.1s steps(1) infinite;
}
.cursor--static { animation: none; }

.splash__bio {
  font-size: 0.9375rem;
  line-height: 1.75;
  color: var(--sub);
  max-width: 500px;
  margin: 18px 0 0;
}

.linkrow {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-top: 22px;
  font-size: 0.8125rem;
}
.linkrow a { color: var(--lga); font-weight: 600; }
.linkrow a:hover { color: var(--ink); }

/* ---- Divider ------------------------------------------------------------- */
.rule {
  color: var(--fnt);
  font-size: 0.8125rem;
  letter-spacing: 2px;
  margin: 44px 0 36px;
  overflow: hidden;
  white-space: nowrap;
}
.rule--tight { margin: 34px 0; }

/* ---- Section headings ---------------------------------------------------- */
.page-title {
  font-size: clamp(1.4rem, 5vw, 1.75rem);
  font-weight: 600;
  margin: 52px 0 0;
  color: var(--ink);
  line-height: 1.2;
}
.page-intro {
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--sub);
  max-width: 500px;
  margin: 12px 0 0;
}

/* ---- Home: "$ tail journal" list ---------------------------------------- */
.label {
  font-size: 0.75rem;
  color: var(--mut);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 18px;
}

.taillist { display: flex; flex-direction: column; gap: 15px; font-size: 0.875rem; }
.taillist__row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 20px;
}
.taillist__row .t { font-weight: 500; color: var(--ink); }
.taillist__row a.t:hover { color: var(--lga); }
.taillist__row .d { color: var(--fnt); white-space: nowrap; }

/* ---- Home: now callout --------------------------------------------------- */
.nowbox {
  display: block;
  margin-top: 40px;
  padding: 16px 18px;
  border: 1px dashed var(--line);
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--sub);
}
.nowbox:hover { color: var(--sub); border-color: var(--lga); }
.nowbox b { color: var(--lga); font-weight: 600; }
.nowbox .arrow { color: var(--mut); }

/* ---- Journal (year-grouped archive) ------------------------------------- */
.year {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--lga);
  margin-bottom: 16px;
}
.entries {
  display: flex;
  flex-direction: column;
  gap: 13px;
  font-size: 0.875rem;
  margin-bottom: 34px;
}
.entry {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
}
.entry__title { font-weight: 500; color: var(--ink); }
.entry a.entry__title:hover { color: var(--lga); }
.entry__leader {
  flex: 1 1 40px;
  min-width: 40px;
  border-bottom: 1px dotted var(--line);
  align-self: stretch;
  margin-bottom: .35em;
}
.entry__date { color: var(--fnt); white-space: nowrap; }

.more-note { font-size: 0.8125rem; color: var(--mut); }

/* ---- Article ------------------------------------------------------------- */
.breadcrumb {
  margin-top: 52px;
  font-size: 0.75rem;
  color: var(--mut);
}
.breadcrumb a { color: var(--mut); }
.breadcrumb a:hover { color: var(--ink); }

.article__title {
  font-size: clamp(1.55rem, 5.5vw, 1.9375rem);
  font-weight: 600;
  line-height: 1.25;
  margin: 10px 0 0;
  letter-spacing: -0.3px;
  color: var(--ink);
}
.article__meta {
  font-size: 0.78125rem;
  color: var(--mut);
  margin-top: 14px;
}

.replybox {
  margin-top: 38px;
  padding: 16px 18px;
  border: 1px dashed var(--line);
  font-size: 0.8125rem;
  color: var(--sub);
}
.replybox a { color: var(--lga); font-weight: 600; }

.pager {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.78125rem;
  color: var(--mut);
  margin-top: 28px;
}
.pager a { color: var(--mut); }
.pager a:hover { color: var(--ink); }

/* ---- Prose (article body, now, sponsors, single pages) ------------------ */
.prose {
  font-size: 0.90625rem;
  line-height: 1.85;
  color: var(--txt);
  max-width: 580px;
}
.prose > *:first-child { margin-top: 0; }
.prose p { margin: 0 0 22px; }
.prose h2, .prose h3, .prose h4 {
  color: var(--ink);
  line-height: 1.3;
  margin: 34px 0 14px;
}
.prose h2 { font-size: 1.2rem; }
.prose h3 { font-size: 1.05rem; }
.prose h4 { font-size: 0.95rem; }
.prose a { color: var(--lga); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
.prose a:hover { color: var(--ink); }
.prose ul, .prose ol { margin: 0 0 22px; padding-left: 1.4em; }
.prose li { margin: 0 0 8px; }
.prose li::marker { color: var(--lga); }
.prose em { font-style: italic; }
.prose strong { font-weight: 600; color: var(--ink); }
.prose hr { border: 0; border-top: 1px dashed var(--line); margin: 34px 0; }
.prose blockquote {
  margin: 0 0 22px;
  padding: 4px 0 4px 20px;
  border-left: 3px solid var(--lga);
  color: var(--sub);
  font-style: italic;
}
.prose blockquote p:last-child { margin-bottom: 0; }
.prose img { display: block; margin: 22px 0; }
.prose img.left  { float: left;  margin: 6px 20px 12px 0; }
.prose img.right { float: right; margin: 6px 0 12px 20px; }

/* inline code */
.prose code {
  background: var(--chip);
  padding: 1px 6px;
  font-size: 0.8125rem;
  border-radius: 3px;
  font-family: inherit;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 22px;
  font-size: 0.85rem;
  display: block;
  overflow-x: auto;
}
.prose th, .prose td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}
.prose th { color: var(--ink); font-weight: 600; }

/* ---- Notes stream -------------------------------------------------------- */
.notes { display: flex; flex-direction: column; gap: 32px; max-width: 580px; }
.note { display: flex; gap: 16px; }
.note__prompt { color: var(--lga); font-weight: 600; flex: none; }
.note__body p { font-size: 0.90625rem; line-height: 1.75; color: var(--txt); margin: 0 0 12px; }
.note__body > *:last-child { margin-bottom: 0; }
.note__date { font-size: 0.75rem; color: var(--fnt); margin-top: 8px; }

/* ---- Now page ------------------------------------------------------------ */
.stamp {
  display: inline-block;
  margin-top: 14px;
  padding: 6px 12px;
  border: 1px dashed var(--line);
  font-size: 0.75rem;
  color: var(--sub);
}
.stamp b { color: var(--lga); font-weight: 600; }

.blocks { display: flex; flex-direction: column; gap: 30px; max-width: 580px; }
.block__title { font-size: 0.9375rem; font-weight: 600; color: var(--lga); }
.block p { font-size: 0.875rem; line-height: 1.75; color: var(--txt); margin: 8px 0 0; }

.aside-note { font-size: 0.78125rem; color: var(--mut); font-style: italic; }

/* ---- Uses grid ----------------------------------------------------------- */
.crates {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
}
.crate { border: 1px dashed var(--line); padding: 20px 22px; }
.crate__label { font-size: 0.8125rem; font-weight: 600; color: var(--lga); margin-bottom: 12px; }
.crate__items { font-size: 0.84375rem; line-height: 2; color: var(--txt); }

/* ---- Donate / sponsor cards --------------------------------------------- */
.cards { display: flex; flex-direction: column; gap: 20px; max-width: 580px; }
.card { border: 1px dashed var(--line); padding: 22px 24px; }
.card__label { font-size: 0.8125rem; font-weight: 600; color: var(--lga); margin-bottom: 10px; }
.card p { font-size: 0.875rem; line-height: 1.7; color: var(--txt); margin: 0 0 14px; }
.btn {
  display: inline-block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--bg);
  background: var(--lga);
  padding: 9px 16px;
}
.btn:hover { color: var(--bg); filter: brightness(1.08); }
.chip {
  display: inline-block;
  font-size: 0.8125rem;
  background: var(--chip);
  padding: 9px 16px;
  color: var(--sub);
  max-width: 100%;
  overflow-wrap: anywhere;
}
.chip b { font-weight: 600; color: var(--ink); }
.chip .mut { color: var(--mut); }

/* ---- Footer (rendered inside .container) --------------------------------- */
.site-footer__inner {
  display: flex;
  justify-content: space-between;
  gap: 12px 16px;
  flex-wrap: wrap;
  margin-top: 56px;
  font-size: 0.71875rem;
  color: var(--fnt);
}
.site-footer a { color: var(--fnt); }
.site-footer a:hover { color: var(--ink); }
.site-footer__social { display: flex; gap: 14px; flex-wrap: wrap; }

/* ---- 404 ----------------------------------------------------------------- */
.notfound { margin-top: 64px; }
.notfound__code {
  font-size: clamp(2.5rem, 12vw, 4rem);
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -1px;
}
.notfound__code .cursor { height: .7em; }

/* ---- Animations ---------------------------------------------------------- */
@keyframes lgblink { 0%,45% { opacity: 1 } 50%,100% { opacity: 0 } }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
  html { scroll-behavior: auto; }
  .cursor { animation: none; }
}

/* ---- Small screens ------------------------------------------------------- */
@media (max-width: 480px) {
  .splash { margin-top: 44px; }
  .masthead { gap: 10px 14px; }
  .nav { gap: 8px 16px; }
}
