/* ==========================================================================
   Murasoviyam 2 — murasoviyam.com
   Every colour below is sampled from Logo/murasoviyam-wordmark.png and
   Logo/murasoviyam-mark.png. Nothing outside those two files is introduced.
   Tamil is set in Korkai. Tamil is never justified: browsers cannot hyphenate
   it, and justification tears rivers through the line.
   ========================================================================== */

@font-face { font-family:"Korkai"; font-weight:300; font-style:normal; font-display:swap;
  src:url("../fonts/Korkai-Light.woff2") format("woff2"), url("../fonts/Korkai-Light.otf") format("opentype"); }
@font-face { font-family:"Korkai"; font-weight:400; font-style:normal; font-display:swap;
  src:url("../fonts/Korkai-Regular.woff2") format("woff2"), url("../fonts/Korkai-Regular.otf") format("opentype"); }
@font-face { font-family:"Korkai"; font-weight:500; font-style:normal; font-display:swap;
  src:url("../fonts/Korkai-Medium.woff2") format("woff2"), url("../fonts/Korkai-Medium.otf") format("opentype"); }
@font-face { font-family:"Korkai"; font-weight:700; font-style:normal; font-display:swap;
  src:url("../fonts/Korkai-Bold.woff2") format("woff2"), url("../fonts/Korkai-Bold.otf") format("opentype"); }
@font-face { font-family:"Korkai"; font-weight:900; font-style:normal; font-display:swap;
  src:url("../fonts/Korkai-Black.woff2") format("woff2"), url("../fonts/Korkai-Black.otf") format("opentype"); }

:root {
  /* Wordmark — the brand line */
  --plum-deep:  #3E004E;
  --plum:       #65126F;
  --violet:     #6F138B;
  --magenta:    #961F94;
  --orchid:     #B25DB0;
  --orchid-pale:#D0A1D1;

  /* Mark — day panels */
  --amber:      #FCA111;
  --gold:       #EAD549;
  --ember:      #DD542A;

  /* Mark — sky and night panels */
  --sky:        #40A8E4;
  --indigo:     #2C3FA9;
  --night:      #081C65;

  /* Mark — light and ink */
  --cream:      #F0F5ED;
  --cream-dim:  #CAD5C9;
  --ink:        #251E2A;

  /* Roles */
  --paper:      var(--cream);
  --text:       var(--ink);
  --text-soft:  var(--plum);
  --rule:       var(--cream-dim);
  --link:       var(--violet);
  --link-hover: var(--magenta);
  --focus:      var(--amber);

  --measure:    34rem;
  --gutter:     16px;

  /* Korkai carries the Tamil, as it does on jokalviyalar.com. Latin sits in
     the system sans beside it — a deliberate pairing, not a fallback chain. */
  --tamil: "Korkai", "Noto Sans Tamil", "Tamil Sangam MN", "Latha", sans-serif;
  --latin: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:     var(--ink);
    --text:      var(--cream);
    --text-soft: var(--orchid-pale);
    --rule:      #3a3340;
    --link:      var(--orchid);
    --link-hover:var(--orchid-pale);
  }
}
:root[data-theme="dark"] {
  --paper:     var(--ink);
  --text:      var(--cream);
  --text-soft: var(--orchid-pale);
  --rule:      #3a3340;
  --link:      var(--orchid);
  --link-hover:var(--orchid-pale);
}

/* --- base --------------------------------------------------------------- */

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--latin);
  font-weight: 400;
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  line-height: 1.7;
  text-align: left;            /* never justify */
  overflow-wrap: break-word;
}

/* Tamil takes Korkai, and takes the extra leading it needs: the script
   carries marks above and below the line and crowds at tighter settings.
   :lang(en) has to be stated rather than left to inherit — an English child
   of a Tamil block matches neither rule otherwise and picks up Korkai's
   Latin from its parent. */
:lang(ta) {
  font-family: var(--tamil);
  line-height: 1.95;
}
:lang(en) {
  font-family: var(--latin);
  line-height: 1.7;
}

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

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--link-hover); }
a:focus-visible,
button:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 2px; }

h1, h2, h3 { font-weight: 500; line-height: 1.4; margin: 0 0 0.6em; }
h1 { font-size: clamp(1.6rem, 1.2rem + 2vw, 2.4rem); }
h2 { font-size: clamp(1.3rem, 1.1rem + 1vw, 1.7rem); }
h3 { font-size: 1.15rem; font-weight: 400; color: var(--text-soft); }
p  { margin: 0 0 1.1em; }

.skip {
  position: absolute; left: -9999px;
  background: var(--paper); color: var(--text);
  padding: 0.6em 1em; z-index: 10;
}
.skip:focus { left: var(--gutter); top: var(--gutter); }

/* ==========================================================================
   Teaser — the home page
   The mark is sixteen panels of sky running daybreak to night. That passage
   is the page: the panel strip under the wordmark is the same journey, and
   it is the only ornament the page gets.
   ========================================================================== */

.teaser {
  min-height: 100svh;
  display: grid;
  grid-template-rows: 1fr auto 1fr;
  padding: 2rem var(--gutter);
}

.teaser__body {
  grid-row: 2;
  width: 100%;
  max-width: 42rem;
  margin: 0 auto;
  text-align: center;
}

.teaser__mark {
  width: min(280px, 62vw);
  margin: 0 auto 2.4rem;
  border-radius: 6px;
  box-shadow: 0 2px 24px rgba(37, 30, 42, 0.18);
}

/* No panel behind it: the artwork carries its own colour for each theme,
   so it sits directly on the paper. See the <picture> in index.html. */
.teaser__wordmark {
  width: min(520px, 88%);
  margin: 0 auto;
}

/* The wordmark is the page's <h1>; the text is there for screen readers
   and for search, and is visually replaced by the artwork. */
.teaser h1 { margin: 0; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.teaser__year {
  margin: 1.8rem 0 0;
  font-family: var(--tamil);
  font-weight: 300;
  font-size: clamp(2.6rem, 1.6rem + 4.4vw, 4.4rem);
  line-height: 1;
  letter-spacing: 0.12em;
  text-indent: 0.12em;          /* balance the trailing letter-space */
  color: var(--text-soft);
}

.teaser__line {
  margin: 1.4rem auto 0;
  max-width: 26rem;
  font-size: 1.0625rem;
  color: var(--text);
}
.teaser__line--en {
  margin-top: 0.5rem;
  font-size: 0.9375rem;
  letter-spacing: 0.04em;
  color: var(--text-soft);
}

/* Day-to-night strip, built from the mark's own sampled panel colours. */
.strip {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  height: 6px;
  width: min(520px, 88%);
  margin: 2.6rem auto 0;
  border-radius: 3px;
  overflow: hidden;
}
.strip span { display: block; }
.strip span:nth-child(1) { background: var(--ember);  }
.strip span:nth-child(2) { background: var(--amber);  }
.strip span:nth-child(3) { background: var(--gold);   }
.strip span:nth-child(4) { background: var(--sky);    }
.strip span:nth-child(5) { background: var(--indigo); }
.strip span:nth-child(6) { background: var(--violet); }
.strip span:nth-child(7) { background: var(--plum);   }
.strip span:nth-child(8) { background: var(--night);  }

.teaser__foot {
  grid-row: 3;
  align-self: end;
  text-align: center;
  font-size: 0.9375rem;
  color: var(--text-soft);
  padding-top: 3rem;
}
.teaser__foot p { margin: 0 0 0.4em; }

/* ==========================================================================
   Inner pages — archive
   ========================================================================== */

.page {
  max-width: calc(var(--measure) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter) 4rem;
}
.page--wide { max-width: 72rem; }

.masthead {
  padding: 1.4rem 0 1.2rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 2.2rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}
/* The full sixteen-panel mark. Below about 44px the panels stop separating,
   so this is the floor rather than a free choice. */
.masthead__mark { width: 44px; height: 44px; border-radius: 5px; flex: none; }
.masthead__name {
  font-size: 1.0625rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
}
.masthead__name:hover { color: var(--link-hover); }
.masthead__where {
  margin-left: auto;
  font-size: 0.875rem;
  color: var(--text-soft);
}

.pagehead { margin-bottom: 2.4rem; }
.pagehead h1 { margin-bottom: 0.3em; }
.pagehead .sub { color: var(--text-soft); margin: 0; }

/* A standing note that this is archived material, not current information. */
.archive-note {
  border-left: 3px solid var(--amber);
  background: color-mix(in srgb, var(--amber) 9%, transparent);
  padding: 0.9rem 1.1rem;
  margin: 0 0 2.4rem;
  font-size: 0.9375rem;
  line-height: 1.7;
  border-radius: 0 4px 4px 0;
}
.archive-note p { margin: 0; }
.archive-note p + p { margin-top: 0.5em; }

.lead { font-size: 1.0625em; }

blockquote {
  margin: 1.6em 0;
  padding-left: 1.1rem;
  border-left: 3px solid var(--orchid);
  color: var(--text);
}

dl.details {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.35rem 1.2rem;
  margin: 0 0 2rem;
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  font-size: 0.9375rem;
}
dl.details dt { color: var(--text-soft); }
dl.details dd { margin: 0; }
@media (max-width: 420px) {
  dl.details { grid-template-columns: 1fr; gap: 0 }
  dl.details dd { margin-bottom: 0.7rem; }
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
  margin: 2rem 0;
  padding: 0;
  list-style: none;
}
.card {
  display: block;
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 1.1rem 1.2rem;
  text-decoration: none;
  color: var(--text);
}
.card:hover { border-color: var(--orchid); color: var(--text); }
.card b { display: block; font-weight: 500; margin-bottom: 0.25em; }
.card span { font-size: 0.875rem; color: var(--text-soft); }

.sitefoot {
  border-top: 1px solid var(--rule);
  margin-top: 3.5rem;
  padding-top: 1.4rem;
  font-size: 0.875rem;
  color: var(--text-soft);
}
.sitefoot p { margin: 0 0 0.4em; }

/* ==========================================================================
   Photo gallery — 367 photographs, 17 June 2012
   Originals are 640x425; thumbnails 240x160. There is no larger source, so
   the viewer never scales a picture past its own pixels.
   ========================================================================== */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  margin: 2rem 0 0;
  padding: 0;
  list-style: none;
}
.gallery a {
  display: block;
  aspect-ratio: 3 / 2;
  background: var(--rule);
  border-radius: 3px;
  overflow: hidden;
}
.gallery img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.gallery a:hover img { transform: scale(1.04); opacity: 0.92; }

/* Lightbox. Without JavaScript each thumbnail is a plain link straight to the
   full image, so the gallery still works with scripting turned off. */
.lightbox {
  position: fixed; inset: 0; z-index: 50;
  display: none;
  align-items: center; justify-content: center;
  background: rgba(8, 28, 101, 0.94);
  padding: 3.5rem 0.5rem 4.5rem;
}
.lightbox[open], .lightbox.is-open { display: flex; }
.lightbox img {
  max-width: 100%; max-height: 100%;
  width: auto;
  border-radius: 3px;
  box-shadow: 0 6px 40px rgba(8, 28, 101, 0.6);
}
.lightbox__bar {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; justify-content: center;
  gap: 0.6rem;
  padding: 0.7rem;
  color: var(--cream);
  font-size: 0.875rem;
}
.lightbox__btn {
  font: inherit;
  font-family: var(--latin);
  background: transparent;
  color: var(--cream);
  border: 1px solid rgba(240, 245, 237, 0.45);
  border-radius: 4px;
  padding: 0.35em 0.9em;
  cursor: pointer;
  min-width: 44px; min-height: 40px;
}
.lightbox__btn:hover { background: rgba(240, 245, 237, 0.14); }
.lightbox__count { min-width: 6.5em; text-align: center; }
.lightbox__close {
  position: absolute; top: 0.6rem; right: 0.6rem;
  min-width: 44px; min-height: 44px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
