/* ==========================================================================
   Vadrevu Srinivas · The Digital Museum
   Editorial design system: tokens → base → components → pages
   ========================================================================== */

:root {
  /* colour */
  --bg: #FFFFFF;
  --bg-2: #F7F7F5;
  --ink: #171717;
  --ink-2: #5C5C5C;
  --red: #D32F2F;
  --red-ink: #B71C1C;      /* red for small text on white (AA contrast) */
  --teal: #145F63;
  --rule: #E2E2E2;

  /* type */
  --f-display: "Bodoni Moda", "Playfair Display", Georgia, serif;
  --f-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-te-display: "Noto Serif Telugu", "Noto Sans Telugu", serif;
  --f-te: "Noto Sans Telugu", "Noto Serif Telugu", sans-serif;

  --t-xs: 0.875rem;   /* 15.75px at 18px root — smallest text on the site */
  --t-sm: 0.94rem;
  --t-md: 1rem;
  --t-lg: 1.22rem;
  --t-xl: 1.6rem;
  --t-2xl: clamp(2rem, 3.4vw, 3rem);
  --t-3xl: clamp(2.6rem, 5vw, 4.2rem);

  /* space */
  --s-1: 0.5rem;
  --s-2: 1rem;
  --s-3: 1.5rem;
  --s-4: 2.5rem;
  --s-5: 4rem;
  --s-6: clamp(4.5rem, 9vw, 8rem);
  --gutter: clamp(20px, 4vw, 56px);
  --max: 1360px;

  --ease: cubic-bezier(.2, .7, .2, 1);
  --nav-h: 76px;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 112.5%; /* 18px */ -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--nav-h) + 16px); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--f-body); font-size: var(--t-md); line-height: 1.65;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 400; }
p { margin: 0 0 1em; }
[lang="te"] { font-family: var(--f-te); line-height: 1.85; }
span[lang="te"], em[lang="te"] { line-height: inherit; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }
button { font: inherit; color: inherit; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: .6rem 1rem; z-index: 100; }
.skip:focus { left: 8px; }

/* ---------- type helpers ---------- */
.kicker { font-family: var(--f-body); font-size: var(--t-xs); font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--red-ink); margin: 0 0 var(--s-2); }
.lead { font-size: var(--t-lg); color: var(--ink-2); line-height: 1.6; }
.muted { color: var(--ink-2); }

/* links: restrained underline that changes colour on hover */
.link {
  color: var(--ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .3em;
  font-weight: 500; transition: color .2s, text-decoration-color .2s;
}
.link:hover { color: var(--red-ink); }
.link .arr { display: inline-block; transition: transform .25s var(--ease); text-decoration: none; }
.link:hover .arr { transform: translateX(4px); }

.btn {
  display: inline-flex; align-items: center; gap: .6rem; min-height: 52px; padding: 0 1.6rem;
  background: var(--ink); color: #fff; text-decoration: none; font-weight: 600; font-size: var(--t-md);
  border: 1px solid var(--ink); border-radius: 2px; cursor: pointer; transition: background .2s, border-color .2s;
}
.btn:hover { background: var(--red); border-color: var(--red); }

/* ---------- navigation ---------- */
.nav { position: sticky; top: 0; z-index: 40; background: var(--bg); border-bottom: 1px solid var(--rule); }
.nav-in { height: var(--nav-h); display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.brand { display: flex; align-items: center; gap: .45rem; text-decoration: none; min-width: 0; }
.brand img { height: 32px; width: auto; flex: none; position: relative; top: 1px; }
.brand-name { font-family: var(--f-display); font-weight: 500; font-variation-settings: "opsz" 14; font-size: 1.25rem; white-space: nowrap; }
.brand-sub { font-size: var(--t-xs); color: var(--ink-2); margin-left: .45rem; padding-left: .8rem; border-left: 1px solid var(--rule); white-space: nowrap; }
.nav-links { display: flex; gap: clamp(1.2rem, 2.6vw, 2.4rem); list-style: none; margin: 0; padding: 0; }
.nav-links a { text-decoration: none; font-size: var(--t-sm); font-weight: 500; padding: .5rem 0; border-bottom: 2px solid transparent; transition: color .2s, border-color .2s; }
.nav-links a:hover { color: var(--red-ink); }
.nav-links a[aria-current="page"] { border-bottom-color: var(--red); }
.nav-toggle { display: none; background: none; border: 1px solid var(--rule); min-height: 44px; padding: 0 1rem; font-weight: 600; cursor: pointer; border-radius: 2px; }

@media (max-width: 960px) {
  .brand-sub { display: none; }
}
@media (max-width: 760px) {
  :root { --nav-h: 64px; }
  .nav-toggle { display: inline-flex; align-items: center; }
  .nav-links {
    display: none; position: absolute; top: var(--nav-h); left: 0; right: 0; flex-direction: column; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--rule); padding: .5rem var(--gutter) 1rem;
  }
  .nav.open .nav-links { display: flex; }
  .nav-links a { display: block; font-size: 1.1rem; padding: .9rem 0; border-bottom: 1px solid var(--rule); }
  .nav-links li:last-child a { border-bottom: 0; }
  .nav-links a[aria-current="page"] { color: var(--red-ink); border-bottom-color: var(--rule); }
}

/* ---------- gentle reveals ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.fade-img { opacity: 0; transition: opacity .6s var(--ease); }
.fade-img.loaded { opacity: 1; }

/* ==========================================================================
   HOME
   ========================================================================== */

/* ---------- hero ---------- */
.hero {
  display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.1fr) minmax(0, 1.15fr);
  gap: clamp(1.5rem, 3vw, 3.5rem); align-items: center;
  padding-top: clamp(2.5rem, 5vw, 4.5rem); padding-bottom: clamp(3rem, 6vw, 5rem);
}
.hero-portrait { align-self: center; justify-self: end; width: 100%; max-width: 440px; margin: 0; }
.hero-portrait img {
  width: 100%;
  /* watercolour fades softly into the white page — no frame */
  -webkit-mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 72%, transparent 100%);
          mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 72%, transparent 100%);
}

.hero-id .kicker { margin-bottom: var(--s-2); }
.hero-te { font-family: var(--f-te-display); font-weight: 700; font-size: clamp(1.9rem, 3vw, 2.8rem); line-height: 1.5; color: var(--red); margin: 0 0 .4rem; }
.hero-id { container-type: inline-size; min-width: 0; }
.hero-en { font-family: var(--f-display); font-weight: 500; font-variation-settings: "opsz" 28; font-size: clamp(2.8rem, 18.5cqi, 6.8rem); line-height: .9; letter-spacing: -.025em; margin: 0; }
.hero-en span { display: block; }
.hero-en span + span { font-style: italic; padding-left: .45em; }
.hero-tag { display: flex; align-items: center; gap: 1rem; margin: var(--s-3) 0 var(--s-2); font-family: var(--f-display); font-style: italic; font-variation-settings: "opsz" 20; font-size: var(--t-xl); }
.hero-tag::before { content: ""; width: 48px; height: 1px; background: var(--red); flex: none; }
.hero-desc { color: var(--ink-2); font-size: var(--t-lg); max-width: 30ch; margin-bottom: var(--s-4); }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-4); }

.hero-art { position: relative; aspect-ratio: 1 / 1.22; }
.art {
  position: absolute; margin: 0; background: #fff; padding: 8px; border: 1px solid var(--rule);
  transition: transform .5s var(--ease);
}
.art a { display: block; }
.art img { width: 100%; }
.art-1 { width: 84%; left: 0; top: 0; transform: rotate(-2deg); z-index: 1; }
.art-2 { width: 76%; right: 0; top: 34%; transform: rotate(1.5deg); z-index: 2; }
.art-3 { width: 70%; left: 6%; top: 66%; transform: rotate(-1deg); z-index: 3; }
.art:hover { transform: rotate(0) translateY(-4px); z-index: 5; }

/* ---------- info strip ---------- */
.strip { border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.strip ul { list-style: none; margin: 0 auto; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); }
.strip li { padding: var(--s-3) var(--s-2); text-align: center; display: flex; align-items: baseline; justify-content: center; gap: .6rem; flex-wrap: wrap; }
.strip li + li { border-left: 1px solid var(--rule); }
.strip strong { font-family: var(--f-display); font-weight: 500; font-variation-settings: "opsz" 20; font-size: var(--t-xl); }
.strip span { color: var(--ink-2); }

/* ---------- section heads ---------- */
.section { padding: var(--s-6) 0; }
.sec-head { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: var(--s-3); margin-bottom: var(--s-5); }
.sec-head h2, .journey h2, .about h2 { font-family: var(--f-display); font-weight: 500; font-variation-settings: "opsz" 28; font-size: var(--t-3xl); line-height: 1.04; letter-spacing: -.01em; }
.sec-head .sub { font-family: var(--f-display); font-style: italic; font-variation-settings: "opsz" 20; font-size: var(--t-xl); color: var(--ink-2); margin: .6rem 0 0; }

/* ---------- featured collections ---------- */
.collections { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(1.5rem, 3vw, 3rem); }
.coll { margin: 0; }
.coll-art { display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 3; overflow: hidden; border: 1px solid var(--rule); background: #fff; padding: 12px; }
.coll-art img { width: 100%; height: 100%; object-fit: contain; transition: transform .7s var(--ease); }
.coll-art:hover img { transform: scale(1.025); }
.coll-num { font-family: var(--f-display); font-style: italic; color: var(--red-ink); font-size: var(--t-lg); display: block; margin: var(--s-3) 0 .2rem; }
.coll h3 { font-family: var(--f-display); font-weight: 500; font-variation-settings: "opsz" 20; font-size: clamp(1.7rem, 2.4vw, 2.2rem); line-height: 1.1; }
.coll .te { font-family: var(--f-te-display); font-weight: 600; font-size: var(--t-lg); color: var(--ink-2); margin: .3rem 0 .8rem; display: block; }
.coll p { color: var(--ink-2); margin-bottom: 1rem; }

/* ---------- journey ---------- */
.journey { background: var(--bg-2); }
.journey-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: clamp(2rem, 6vw, 6rem); align-items: start; }
.journey-photos { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; align-items: end; position: sticky; top: calc(var(--nav-h) + 40px); }
.journey-photos figure { margin: 0; }
.journey h2 { margin-bottom: var(--s-3); }
.journey .lead { margin-bottom: var(--s-4); }
.chapters { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.chapter { display: grid; grid-template-columns: 8rem 1fr; gap: var(--s-3); padding: var(--s-3) 0; border-bottom: 1px solid var(--rule); }
.chapter-when { font-family: var(--f-display); font-weight: 500; font-variation-settings: "opsz" 20; font-size: var(--t-xl); line-height: 1.2; }
.chapter h3 { font-family: var(--f-display); font-weight: 500; font-variation-settings: "opsz" 20; font-size: var(--t-xl); line-height: 1.25; margin-bottom: .3rem; }
.chapter p { color: var(--ink-2); margin: 0; }
.chapter-art { display: block; margin-top: 1rem; width: 220px; border: 1px solid var(--rule); background: #fff; }
.chapter-art img { width: 100%; }

/* ---------- about ---------- */
.about-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: clamp(2rem, 6vw, 6rem); align-items: start; }

.about-body { font-size: var(--t-lg); }
.about-body p { max-width: 60ch; }
.about-sig { height: 54px; width: auto; margin-top: var(--s-3); }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--rule); padding: var(--s-4) 0; }
.footer-in { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-2) var(--s-4); align-items: center; color: var(--ink-2); font-size: var(--t-sm); }
.footer p { margin: 0; }

/* ==========================================================================
   ARCHIVE
   ========================================================================== */
.arch-head { padding-top: clamp(2.5rem, 5vw, 4.5rem); padding-bottom: var(--s-4); display: flex; flex-wrap: wrap; align-items: baseline; gap: .4rem 1.4rem; }
.arch-head h1 { font-family: var(--f-display); font-weight: 500; font-variation-settings: "opsz" 28; font-size: clamp(3rem, 6vw, 5.4rem); line-height: 1; letter-spacing: -.02em; }
.arch-head .te-h { font-family: var(--f-te-display); font-weight: 600; font-size: clamp(1.6rem, 2.6vw, 2.2rem); line-height: 1.5; color: var(--red); }
.arch-head p { flex-basis: 100%; color: var(--ink-2); font-size: var(--t-lg); margin: .8rem 0 0; }

.toolbar { position: sticky; top: var(--nav-h); z-index: 30; background: var(--bg); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.toolbar-in { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem var(--s-4); padding-top: .9rem; padding-bottom: .9rem; }
.search { flex: 1 1 340px; display: flex; align-items: center; border: 1px solid var(--ink); border-radius: 2px; background: #fff; min-height: 52px; }
.search:focus-within { outline: 2px solid var(--teal); outline-offset: 2px; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; font: inherit; font-size: 1.05rem; padding: .7rem 1rem; background: transparent; color: var(--ink); }
.search input::placeholder { color: #767676; }
.search input::-webkit-search-cancel-button { display: none; }
.search-clear { border: 0; background: none; cursor: pointer; padding: 0 1rem; min-height: 50px; color: var(--ink-2); font-size: var(--t-sm); }
.search-clear[hidden] { display: none; }
.seg { display: flex; align-items: center; gap: .15rem; }
.seg-label { font-size: var(--t-xs); color: var(--ink-2); margin-right: .45rem; }
.seg button {
  background: none; border: 0; cursor: pointer; padding: .5rem .55rem; min-height: 44px; font-size: var(--t-sm); font-weight: 500; color: var(--ink-2);
  border-bottom: 2px solid transparent; transition: color .2s, border-color .2s;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--red); }
.year { font: inherit; font-size: var(--t-sm); min-height: 44px; padding: 0 .8rem; border: 1px solid var(--rule); border-radius: 2px; background: #fff; color: var(--ink); }
.year[hidden] { display: none; }

.status { padding: var(--s-3) 0 var(--s-2); color: var(--ink-2); margin: 0; }
.status strong { color: var(--ink); font-weight: 600; }

.gallery { columns: 3 340px; column-gap: clamp(20px, 2.6vw, 40px); padding-bottom: var(--s-5); }
.item { break-inside: avoid; margin: 0 0 clamp(28px, 3.4vw, 48px); }
.item button { display: block; width: 100%; padding: 0; border: 1px solid var(--rule); background: #fff; cursor: zoom-in; overflow: hidden; }
.item img { width: 100%; background: var(--bg-2); transition: transform .6s var(--ease), opacity .6s var(--ease); }
.item button:hover img { transform: scale(1.02); }
.item figcaption { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding-top: .6rem; }
.item .t { font-family: var(--f-te); font-size: 1.08rem; line-height: 1.6; }
.item .d { font-size: var(--t-xs); color: var(--ink-2); white-space: nowrap; margin-left: auto; }
.empty { padding: var(--s-5) 0; text-align: center; color: var(--ink-2); font-size: var(--t-lg); }
#more { height: 1px; }

/* ---------- viewer: opening a cartoon is turning a page ---------- */
.viewer { position: fixed; inset: 0; z-index: 60; background: var(--bg); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.viewer[hidden] { display: none; }
.viewer:focus { outline: none; }
.v-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; height: var(--nav-h); border-bottom: 1px solid var(--rule);
  padding: 0 max(var(--gutter), calc((100vw - var(--max)) / 2 + var(--gutter))); }
.v-close { background: none; border: 0; cursor: pointer; font-weight: 600; min-height: 44px; padding: 0; }
.v-close:hover { color: var(--red-ink); }
.v-count { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.v-stage { display: flex; align-items: center; justify-content: center; padding: clamp(12px, 2.5vw, 32px) var(--gutter); min-height: 0; overflow: hidden; }
.v-stage img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; border: 1px solid var(--rule); background: #fff; }
.v-stage img.turn-next { animation: turnNext .45s var(--ease); }
.v-stage img.turn-prev { animation: turnPrev .45s var(--ease); }
@keyframes turnNext { from { opacity: 0; transform: translateX(36px); } to { opacity: 1; transform: none; } }
@keyframes turnPrev { from { opacity: 0; transform: translateX(-36px); } to { opacity: 1; transform: none; } }
.v-foot { border-top: 1px solid var(--rule); }
.v-foot-in { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .6rem var(--s-4); padding-top: .9rem; padding-bottom: .9rem; }
.v-title { font-family: var(--f-te-display); font-weight: 600; font-size: clamp(1.25rem, 2vw, 1.6rem); line-height: 1.5; margin: 0; }
.v-date { color: var(--ink-2); font-size: var(--t-sm); margin: 0; }
.v-actions { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }
.v-btn { min-height: 48px; min-width: 48px; padding: 0 1.1rem; background: #fff; border: 1px solid var(--ink); border-radius: 2px; cursor: pointer; font-weight: 600; font-size: var(--t-sm); transition: background .2s, color .2s; }
.v-btn:hover { background: var(--ink); color: #fff; }
.toast { position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: .7rem 1.2rem; font-size: var(--t-sm); z-index: 70; border-radius: 2px; }
.toast[hidden] { display: none; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 1180px) {
  .hero { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); }
  .hero-portrait { grid-row: 1; grid-column: 1; justify-self: stretch; max-width: none; }
  .hero-id { grid-row: 1; grid-column: 2; }
  .hero-art { grid-column: 1 / -1; aspect-ratio: auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-3); align-items: start; }
  .art { position: static; width: auto; transform: none; }
  .art-1 { transform: rotate(-1.2deg); } .art-3 { transform: rotate(1deg); }
}
@media (max-width: 900px) {
  .collections { gap: 1.25rem; }
  .coll h3 { font-size: 1.5rem; }
  .journey-grid, .about-grid { grid-template-columns: 1fr; }
  .journey-photos { position: static; }
  .sec-head { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  html { font-size: 106.25%; /* 17px */ }
  .hero { grid-template-columns: 1fr; padding-top: var(--s-3); }
  .hero-id { grid-row: 1; grid-column: 1; }
  .hero-portrait { grid-row: 2; grid-column: 1; max-width: 340px; justify-self: center; }
  .hero-art { grid-row: 3; grid-template-columns: 1fr; gap: var(--s-3); }
  .art, .art-1, .art-3 { transform: none; }
  .hero-desc { max-width: none; }
  .strip ul { grid-template-columns: 1fr; }
  .strip li + li { border-left: 0; border-top: 1px solid var(--rule); }
  .strip li { padding: var(--s-2); }
  .collections { grid-template-columns: 1fr; }
  .chapter { grid-template-columns: 1fr; gap: .3rem; }
  .chapter-art { width: 100%; max-width: 360px; }
  .toolbar { position: static; }
  .gallery { columns: 1; }
  .v-foot-in { grid-template-columns: 1fr; }
  .v-actions { flex-wrap: nowrap; }
  .v-actions .v-btn { flex: 1; padding: 0 .5rem; white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal, .fade-img { opacity: 1; transform: none; }
}

/* ---------- about: his motto ---------- */
.motto { margin: 0 0 var(--s-4); padding: 0 0 var(--s-3); border-bottom: 1px solid var(--rule); }
.motto p { font-family: var(--f-te-display); font-weight: 600; font-size: clamp(1.6rem, 2.6vw, 2.2rem); line-height: 1.6; color: var(--red); margin: 0 0 .4rem; }
.motto footer { font-family: var(--f-display); font-style: italic; font-variation-settings: "opsz" 20; font-size: var(--t-lg); color: var(--ink-2); }
.source { font-size: var(--t-xs); color: var(--ink-2); margin-top: var(--s-3); }
