/* Smile... — quiet editorial theme
   Palette: warm cream paper, deep brown ink, rust/terracotta accent.

   Layout follows the reference: an oversized site mark, a pill-shaped nav,
   and a list of posts separated by hairline rules. No cards, no thumbnails. */

:root {
  --bg: #f7f0e3;
  --surface: #fffaf1;
  --ink: #3d2b1f;
  --ink-soft: #6d5947;
  --muted: #96816c;
  --accent: #a04a2b;
  --accent-deep: #7d3820;
  --gold: #c9a227;
  --rule: #e4d7bf;
  --serif-tamil: "Noto Serif Tamil", "Newsreader", Georgia, serif;
  --serif: "Newsreader", "Noto Serif Tamil", Georgia, serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scrollbar-gutter: stable; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif-tamil);
  font-size: 1.05rem;
  line-height: 1.9;
  /* subtle warm vignette */
  background-image: radial-gradient(ellipse at top, rgba(201, 162, 39, 0.07), transparent 60%);
  background-repeat: no-repeat;
}

.wrap { max-width: 40rem; margin: 0 auto; padding: 0 1.35rem; }

a { color: var(--accent); text-decoration-color: rgba(160, 74, 43, 0.35); text-underline-offset: 3px; }
a:hover { color: var(--accent-deep); text-decoration-color: var(--accent-deep); }

/* ---------- Header ---------- */
.site-header { padding: 4rem 0 0; }

.site-title {
  display: inline-block;
  font-family: var(--serif);
  font-size: clamp(2.5rem, 9vw, 4.25rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.025em;
  color: var(--ink);
  text-decoration: none;
}
.site-title:hover { color: var(--accent); }

.site-tagline {
  margin: 0.6rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  font-style: italic;
  line-height: 1.7;
}

.site-nav {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.15rem;
  margin-top: 1.9rem;
  padding: 0.3rem;
  border-radius: 999px;
  background: rgba(61, 43, 31, 0.055);
}
.site-nav a {
  position: relative;
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-size: 0.88rem;
  line-height: 1;
  color: var(--ink-soft);
  text-decoration: none;
  white-space: nowrap;
}
.site-nav a:hover { color: var(--ink); }
.site-nav a.is-active { color: var(--ink); font-weight: 600; }

/* Make the active item bold without moving anything. Bold text is wider than
   regular, so whichever label went bold used to shove every label after it
   sideways -- the nav sat a few pixels different on each page, and the named
   labels would visibly twitch during a page transition. All four labels now
   carry a hidden bold copy in the same grid cell, so each item is always as
   wide as its boldest state and toggling weight changes nothing. */
.site-nav .label {
  position: relative;
  display: inline-grid;
}
.site-nav .label > * { grid-area: 1 / 1; }
.site-nav .reserve { font-weight: 600; visibility: hidden; }

/* The pill is a textless element inside the link, not a background on it.
   That matters for the page transition below: the pill gets lifted out of the
   page snapshot on its own and morphs from the old link to the new one, while
   the labels stay put and cross-fade in place. If the pill were the <a> itself
   the morph would drag the label with it and ghost against the cross-fade. */
.site-nav .pill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(61, 43, 31, 0.13);
  opacity: 0;
}
.site-nav a.is-active .pill { opacity: 1; }
.site-nav .label { position: relative; }

/* ---------- Cross-document page transition ----------
   Clicking a nav link no longer flashes white: the browser cross-fades the
   page and slides the pill from the old link to the new one. Opt-in on both
   ends, no JavaScript. Chrome 126+ and Safari 18.2+; Firefox only has
   same-document transitions, where this is simply ignored and navigation
   behaves exactly as before. */
@view-transition {
  navigation: auto;
}

@media (prefers-reduced-motion: no-preference) {
  /* Naming the pill is what makes it travel. Scoped to no-preference so that
     with reduced motion it just cross-fades with everything else. */
  .site-nav a.is-active .pill {
    view-transition-name: nav-pill;
  }

  /* The labels need their own names too, otherwise the travelling pill paints
     over them and they visibly blink out -- groups stack in tree order, and
     the pill is the first child of the first link. These four never move, so
     their cross-fade is invisible; it just puts them above the pill. */
  .site-nav a:nth-child(1) .label { view-transition-name: nav-label-1; }
  .site-nav a:nth-child(2) .label { view-transition-name: nav-label-2; }
  .site-nav a:nth-child(3) .label { view-transition-name: nav-label-3; }
  .site-nav a:nth-child(4) .label { view-transition-name: nav-label-4; }

  ::view-transition-group(nav-pill) {
    animation-duration: 340ms;
    animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
  }
}

/* ---------- Post list ---------- */
.post-list { padding: 3rem 0 3.5rem; }
.list .post-list { padding-top: 0.5rem; }

.post-item {
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--rule);
}
.post-item:first-child { border-top: 1px solid var(--rule); }

.post-item h2 {
  margin: 0.5rem 0 0;
  font-size: 1.28rem;
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: -0.01em;
}
.post-item h2 a { color: var(--ink); text-decoration: none; }
.post-item h2 a:hover { color: var(--accent); }

.post-item p {
  margin: 0.55rem 0 0;
  color: var(--ink-soft);
  font-size: 0.97rem;
  line-height: 1.75;
}

/* ---------- Meta ---------- */
.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--muted);
}
.meta a { color: inherit; text-decoration: none; }
.meta a:hover { color: var(--accent); text-decoration: underline; }
.meta .meta-sep { color: var(--rule); }

/* ---------- Single post ---------- */
.post-header { padding: 3rem 0 1.6rem; }
.post-header h1 {
  margin: 0 0 0.8rem;
  font-size: clamp(1.75rem, 5.5vw, 2.4rem);
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.post-header .meta { justify-content: flex-start; }

.post .content { padding-bottom: 2.5rem; }
.content p { margin: 0 0 1.35em; }
.content p:last-child { margin-bottom: 0; }
.content img { max-width: 100%; height: auto; border-radius: 4px; }
.content blockquote {
  margin: 1.5em 0; padding: 0.4em 1.2em;
  border-left: 3px solid var(--gold); color: var(--ink-soft);
  background: rgba(201, 162, 39, 0.06); border-radius: 0 4px 4px 0;
}

.post-nav {
  display: flex; justify-content: space-between; gap: 1.5rem;
  padding: 1.5rem 0 3.5rem;
  border-top: 1px solid var(--rule);
  font-size: 0.95rem;
}
.post-nav a { max-width: 48%; text-decoration: none; color: var(--ink-soft); line-height: 1.55; }
.post-nav a:hover { color: var(--accent); }
.post-nav .next { text-align: right; margin-left: auto; }

/* ---------- List / terms / 404 pages ---------- */
.list h1, .terms h1, .notfound h1 {
  margin: 0;
  padding: 3.5rem 0 1.5rem;
  font-size: clamp(1.75rem, 5.5vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.terms-list { list-style: none; margin: 0; padding: 0 0 3.5rem; }
.terms-list li {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--rule);
}
.terms-list li:first-child { border-top: 1px solid var(--rule); }
.terms-list a { color: var(--ink); text-decoration: none; }
.terms-list a:hover { color: var(--accent); }
.terms-list .count { color: var(--muted); font-size: 0.85rem; }

.notfound p { padding-bottom: 4rem; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--rule);
  padding: 1.5rem 0 2.5rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.site-footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.6rem; }
.footer-links a { margin-left: 1.1rem; color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--accent); }

@media (max-width: 560px) {
  body { font-size: 1rem; }
  .site-header { padding-top: 2.75rem; }
  .post-list { padding-top: 2.25rem; }
  .list .post-list { padding-top: 0.5rem; }
  .post-item { padding: 1.4rem 0; }
  .site-nav { gap: 0.1rem; padding: 0.25rem; }
  .site-nav a { padding: 0.45rem 0.7rem; font-size: 0.82rem; }
  .site-footer .wrap { flex-direction: column; }
  .footer-links a { margin: 0 1.1rem 0 0; }
}
