/* ==========================================================================
   Swarnaratna — site styles
   1. Tokens        colours, type, spacing (change the look from here)
   2. Base          reset, typography, links, buttons
   3. Layout        wrap, sections, header, footer
   4. Components    hero, kolam, tiles, gems, steps, marks, details, faq
   5. Motion        load sequence, scroll reveal, reduced motion
   ========================================================================== */

/* 1. Tokens --------------------------------------------------------------- */
:root {
  /* Colour: drawn from gold on a jeweller's cloth, Kanchipuram maroon, silver and emerald */
  --paper: #fbfaf8;
  --ink: #2b2122;
  --muted: #6e6260;
  --arakku: #5a1822;        /* deep silk maroon: headings, primary actions */
  --arakku-deep: #43101a;
  --gold: #b58b3b;          /* lines and ornaments */
  --gold-deep: #86621c;     /* gold that is readable as text on paper */
  --taupe: #ded6d2;         /* image placeholders, quiet panels */
  --velli: #e8ebed;         /* silver section */
  --emerald: #103b34;       /* gemstone section */

  /* Per-section colours. Sections override these; components only read them. */
  --bg: var(--paper);
  --fg: var(--ink);
  --fg-muted: var(--muted);
  --heading: var(--arakku);
  --accent: var(--gold-deep);
  --rule: rgba(43, 33, 34, 0.16);

  /* Type */
  --font-display: "Tiro Tamil", "Iowan Old Style", Georgia, serif;
  --font-body: "Hind Madurai", "Helvetica Neue", Arial, sans-serif;
  --fs-small: 0.9375rem;
  --fs-body: 1.0625rem;
  --fs-lead: clamp(1.1875rem, 1.1rem + 0.4vw, 1.375rem);
  --fs-h3: clamp(1.3125rem, 1.2rem + 0.5vw, 1.5rem);
  --fs-h2: clamp(2.125rem, 1.5rem + 2.6vw, 3.5rem);
  --fs-h1: clamp(2.5rem, 1.6rem + 3.6vw, 4.25rem);

  /* Space */
  --gutter: clamp(1.25rem, 0.6rem + 3vw, 3rem);
  --section: clamp(4.5rem, 2.5rem + 8vw, 9rem);
  --wrap: 78rem;
  --header-h: 4.5rem;

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* 2. Base ----------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1.5rem);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

h1, h2, h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--heading);
  text-wrap: balance;
}
h1 { font-size: var(--fs-h1); line-height: 1.04; letter-spacing: -0.015em; }
h2 { font-size: var(--fs-h2); line-height: 1.08; letter-spacing: -0.01em; }
h3 { font-size: var(--fs-h3); line-height: 1.25; }

p { margin: 0; text-wrap: pretty; }
ul, ol, dl, dd, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }

a { color: inherit; }

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

::selection { background: var(--arakku); color: var(--paper); }

/* Tamil gloss beside an English heading */
.ta {
  font-family: var(--font-display);
  font-size: 0.46em;
  letter-spacing: 0;
  color: var(--accent);
  margin-inline-start: 0.5em;
  white-space: nowrap;
}

.lead { font-size: var(--fs-lead); line-height: 1.45; max-width: 34rem; }
.muted { color: var(--fg-muted); }
.small { font-size: var(--fs-small); }

/* Text link with a gold underline */
.link {
  color: var(--heading);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--gold);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
  transition: text-decoration-color 0.25s, text-underline-offset 0.25s var(--ease);
}
.link:hover { text-decoration-color: currentColor; text-underline-offset: 0.42em; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.55rem 1.5rem;
  border: 1px solid var(--arakku);
  border-radius: 2px;
  background: var(--arakku);
  color: var(--paper);
  font: 500 1rem/1.2 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.25s, color 0.25s, border-color 0.25s;
}
.btn:hover { background: var(--arakku-deep); border-color: var(--arakku-deep); }

.btn-quiet { background: transparent; color: var(--heading); border-color: var(--fg-muted); }
.btn-quiet:hover { background: var(--heading); color: var(--bg); border-color: var(--heading); }

.btn-light { background: var(--paper); color: var(--arakku); border-color: var(--paper); }
.btn-light:hover { background: transparent; color: var(--paper); border-color: var(--paper); }

.btn-small { min-height: 2.5rem; padding: 0.4rem 1.1rem; font-size: 0.9375rem; }

.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--arakku);
  color: var(--paper);
  transition: top 0.2s;
}
.skip:focus { top: 1rem; }

/* 3. Layout --------------------------------------------------------------- */
.wrap {
  width: min(100% - 2 * var(--gutter), var(--wrap));
  margin-inline: auto;
}

.section {
  padding-block: var(--section);
  background: var(--bg);
  color: var(--fg);
}
.section-tight { padding-block: calc(var(--section) * 0.6); }
.flush-top { padding-top: 0; }

/* Section colourways */
.on-velli   { --bg: var(--velli); --rule: rgba(43, 33, 34, 0.18); }
.on-emerald { --bg: var(--emerald); --fg: #f3efe6; --fg-muted: rgba(243, 239, 230, 0.72); --heading: #f7f2e6; --accent: #d9b56a; --rule: rgba(243, 239, 230, 0.22); }
.on-arakku  { --bg: var(--arakku); --fg: #f8efe9; --fg-muted: rgba(248, 239, 233, 0.74); --heading: #fbf3ec; --accent: #dcb86c; --rule: rgba(248, 239, 233, 0.24); }

/* Section heading row: title and intro on the left, link on the right */
.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 1.5rem 3rem;
  margin-bottom: clamp(2rem, 1.2rem + 3vw, 3.5rem);
}
.section-head p { margin-top: 1.1rem; max-width: 36rem; }

/* Closing band: a line of copy with actions beside it */
.band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 1.5rem 3rem;
}
.band p { margin-top: 0.9rem; }

/* Two-column split used by gemstones, savings and visit blocks */
.split {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(2rem, 1rem + 5vw, 6rem);
  align-items: center;
}
.split-top { align-items: start; }
.stack > * + * { margin-top: 1.5rem; }

/* Header */
site-header {
  display: block;
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: var(--header-h);
}
.site-header {
  background: rgba(251, 250, 248, 0.9);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}
.site-header.is-scrolled { border-bottom-color: var(--rule); }

.header-inner {
  display: flex;
  align-items: center;
  gap: 2rem;
  min-height: var(--header-h);
}
.brand {
  margin-inline-end: auto;
  font-family: var(--font-display);
  font-size: 1.625rem;
  line-height: 1;
  color: var(--arakku);
  text-decoration: none;
}
.brand img { height: 2.5rem; width: auto; }

.site-nav ul { display: flex; gap: clamp(1rem, 0.2rem + 1.6vw, 2.25rem); }
.site-nav a {
  display: inline-block;
  padding-block: 0.5rem;
  font-size: 1rem;
  text-decoration: none;
  background: linear-gradient(var(--gold), var(--gold)) no-repeat 0 100% / 0 1px;
  transition: background-size 0.35s var(--ease), color 0.2s;
}
.site-nav a:hover, .site-nav a[aria-current="page"] { background-size: 100% 1px; color: var(--arakku); }

.nav-toggle {
  display: none;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.75rem;
  padding: 0 0.25rem;
  border: 0;
  background: none;
  color: var(--arakku);
  font: 500 1rem var(--font-body);
  cursor: pointer;
}
.nav-toggle-bars { position: relative; width: 1.375rem; height: 0.625rem; }
.nav-toggle-bars::before, .nav-toggle-bars::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 1.5px;
  background: currentColor;
  transition: transform 0.3s var(--ease);
}
.nav-toggle-bars::before { top: 0; }
.nav-toggle-bars::after { bottom: 0; }
.nav-open .nav-toggle-bars::before { transform: translateY(0.265rem) rotate(45deg); }
.nav-open .nav-toggle-bars::after { transform: translateY(-0.265rem) rotate(-45deg); }

/* Footer */
.site-footer {
  padding-block: clamp(3rem, 2rem + 4vw, 5rem) 2rem;
  border-top: 1px solid var(--rule);
  font-size: var(--fs-small);
}
.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 3fr) minmax(0, 4fr);
  gap: 2.5rem clamp(2rem, 1rem + 4vw, 5rem);
}
.footer-brand { font-family: var(--font-display); font-size: 2rem; line-height: 1; color: var(--arakku); }
.footer-brand + p { margin-top: 1rem; max-width: 24rem; color: var(--muted); }
.footer-title { font: 600 var(--fs-small) var(--font-body); color: var(--ink); margin-bottom: 0.75rem; }
.footer-list li + li { margin-top: 0.4rem; }
.footer-list a { text-decoration: none; }
.footer-list a:hover { text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 0.3em; }
.footer-base {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  margin-top: clamp(2.5rem, 2rem + 3vw, 4rem);
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
}

/* 4. Components ----------------------------------------------------------- */

/* Hero */
.hero { padding-block: clamp(1.5rem, 0.5rem + 3vw, 3.5rem) var(--section); }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 11fr) minmax(0, 9fr);
  gap: clamp(2rem, 1rem + 5vw, 6rem);
  align-items: stretch;
}
.hero-copy { align-self: center; padding-block: clamp(0rem, -1rem + 3vw, 2rem); }
.hero-copy h1 { margin-top: clamp(1.5rem, 1rem + 2vw, 2.5rem); max-width: 15ch; }
.hero-copy .lead { margin-top: 1.75rem; }
.hero-copy .actions { margin-top: 2.25rem; }
.hero-photo {
  min-height: clamp(26rem, 68vh, 44rem);
  overflow: hidden;
  background: var(--taupe);
}
.hero-photo img { width: 100%; height: 100%; object-fit: cover; }

/* Kolam: the threshold drawing. Dots first, then one line looped around them. */
.kolam { width: clamp(6rem, 4rem + 5vw, 8.5rem); height: auto; overflow: visible; }
.kolam-dots { fill: var(--arakku); }
.kolam-line { fill: none; stroke: var(--gold); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* Page head for inner pages */
.page-head { padding-block: clamp(2.5rem, 1.5rem + 4vw, 5rem) clamp(2.5rem, 1.5rem + 4vw, 4.5rem); }
.page-head-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 1.5rem clamp(2rem, 1rem + 5vw, 6rem);
  align-items: end;
}
.page-head h1 { font-size: clamp(2.375rem, 1.5rem + 3.6vw, 4.25rem); }
.crumbs { margin-bottom: 1.5rem; font-size: var(--fs-small); color: var(--muted); }
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 0.3em; }
.crumbs li { display: inline; }
.crumbs li + li::before { content: "/"; margin-inline: 0.5em; color: var(--gold); }

/* Category tiles */
.tiles {
  display: grid;
  grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr));
  gap: clamp(2rem, 1.5rem + 2vw, 3.5rem) clamp(1rem, 0.5rem + 1.6vw, 2rem);
}
.tiles-3 { --cols: 3; }
.tile { display: block; color: inherit; text-decoration: none; scroll-margin-top: calc(var(--header-h) + 1.5rem); }
.tile-media { aspect-ratio: 1 / 1; overflow: hidden; background: var(--taupe); }
.tile-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s var(--ease); }
a.tile:hover .tile-media img, a.tile:focus-visible .tile-media img { transform: scale(1.04); }
.tile-name { margin-top: 1rem; font-family: var(--font-display); font-size: var(--fs-h3); line-height: 1.2; color: var(--heading); }
.tile-name .ta { font-size: 0.68em; }
.tile-note { margin-top: 0.3rem; font-size: var(--fs-small); line-height: 1.5; color: var(--fg-muted); }
/* A tile waiting for its photograph */
.tile-media-empty { display: grid; place-items: center; color: var(--muted); font-size: var(--fs-small); }

/* Framed photograph in split layouts */
.photo { overflow: hidden; background: var(--taupe); }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo-tall { aspect-ratio: 4 / 5; }

/* Navaratna: nine gems, each with its colour */
.gems {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--rule);
}
.gem { padding: 0.9rem 0.5rem 0.9rem 0; border-bottom: 1px solid var(--rule); line-height: 1.35; }
.gem::before {
  content: "";
  display: inline-block;
  width: 0.625rem;
  height: 0.625rem;
  margin-inline-end: 0.6rem;
  border-radius: 50%;
  background: var(--gem);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.28);
}
.gem .ta { display: block; margin: 0.15rem 0 0 1.225rem; font-size: 0.875rem; color: var(--fg-muted); }

/* Numbered steps: a real sequence (enrol, pay, redeem) */
.steps { counter-reset: step; border-top: 1px solid var(--rule); }
.step {
  counter-increment: step;
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr);
  padding-block: 1.5rem;
  border-bottom: 1px solid var(--rule);
}
.step::before {
  content: counter(step);
  font-family: var(--font-display);
  font-size: 2rem;
  line-height: 1;
  color: var(--accent);
}
.step h3 { font-size: var(--fs-h3); }
.step p { margin-top: 0.35rem; color: var(--fg-muted); }

/* Purity marks: the numbers stamped on the metal */
.marks {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2.5rem clamp(1.5rem, 1rem + 3vw, 4rem);
}
.mark { padding-top: 1.5rem; border-top: 1px solid var(--rule); }
.mark-stamp {
  font-family: var(--font-display);
  font-size: clamp(2.75rem, 2rem + 2.6vw, 4rem);
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--heading);
}
.mark h3 { margin-top: 1rem; font: 600 var(--fs-body) / 1.4 var(--font-body); color: var(--fg); }
.mark h3 + p { margin-top: 0.4rem; color: var(--fg-muted); }

/* Store details (address, hours, phone) */
.details { border-top: 1px solid var(--rule); }
.details-row {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr);
  gap: 1rem;
  padding-block: 1.1rem;
  border-bottom: 1px solid var(--rule);
}
.details dt { color: var(--fg-muted); }
.details a { text-decoration-color: var(--gold); text-underline-offset: 0.3em; }
.hours li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 1.5rem; }

/* Prose block for longer copy */
.prose { max-width: 40rem; }
.prose > * + * { margin-top: 1.1rem; }
.prose h2 { font-size: clamp(1.75rem, 1.4rem + 1.4vw, 2.5rem); }
.prose h2 + * { margin-top: 1.25rem; }

/* FAQ */
.faq { border-top: 1px solid var(--rule); }
.faq details { border-bottom: 1px solid var(--rule); }
.faq summary {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.5rem;
  padding-block: 1.2rem;
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  line-height: 1.3;
  color: var(--heading);
  cursor: pointer;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  font-family: var(--font-body);
  font-size: 1.5rem;
  line-height: 1;
  color: var(--accent);
  transition: transform 0.3s var(--ease);
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { padding-bottom: 1.4rem; max-width: 38rem; color: var(--fg-muted); }

/* Image credits table */
.table-scroll { overflow-x: auto; }
.credits { width: 100%; min-width: 44rem; border-collapse: collapse; font-size: var(--fs-small); text-align: left; }
.credits th, .credits td { padding: 0.75rem 1rem 0.75rem 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.credits th { font-weight: 600; }
.credits a { text-decoration-color: var(--gold); text-underline-offset: 0.3em; }

/* Draft marker: content that still needs the store's real details */
.todo {
  background: linear-gradient(transparent 62%, rgba(181, 139, 59, 0.35) 0);
}

/* 5. Motion --------------------------------------------------------------- */

/* One load sequence on the home page: photo settles, copy arrives, the kolam is drawn. */
@keyframes settle { from { opacity: 0; transform: scale(1.035); } to { opacity: 1; transform: none; } }
@keyframes arrive { from { opacity: 0; transform: translateY(0.9rem); } to { opacity: 1; transform: none; } }
@keyframes appear { from { opacity: 0; } to { opacity: 1; } }
@keyframes draw   { to { stroke-dashoffset: 0; } }

.hero-photo img { animation: settle 1.6s var(--ease) both; }
.hero-copy h1, .hero-copy .lead, .hero-copy .actions { animation: arrive 1s var(--ease) both; }
.hero-copy h1 { animation-delay: 0.15s; }
.hero-copy .lead { animation-delay: 0.3s; }
.hero-copy .actions { animation-delay: 0.45s; }

.kolam-dots circle { animation: appear 0.5s both; animation-delay: calc(0.2s + var(--n, 0) * 18ms); }
.kolam-line path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw 2.4s cubic-bezier(0.5, 0, 0.2, 1) forwards;
  animation-delay: calc(0.8s + var(--i, 0) * 0.32s);
}

/* Scroll reveal. Only active when JS has confirmed it can un-hide things. */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(1rem);
  transition: opacity 0.9s ease, transform 0.9s var(--ease);
  transition-delay: calc(var(--d, 0) * 80ms);
}
.js [data-reveal].is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .kolam-line path { stroke-dashoffset: 0; }
  .js [data-reveal] { opacity: 1; transform: none; }
}

/* Responsive -------------------------------------------------------------- */
@media (max-width: 62rem) {
  .tiles { --cols: 2; }
  .marks { grid-template-columns: minmax(0, 1fr); gap: 2rem; }
  .footer-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .footer-grid > :first-child { grid-column: 1 / -1; }
}

@media (max-width: 56rem) {
  .hero-grid, .split, .page-head-grid { grid-template-columns: minmax(0, 1fr); }
  .hero-photo { min-height: 0; aspect-ratio: 1 / 1; }
  .section-head, .band { grid-template-columns: minmax(0, 1fr); }

  /* Mobile navigation */
  .nav-toggle { display: inline-flex; }
  .header-cta { display: none; }
  .site-nav {
    position: absolute;
    inset: 100% 0 auto 0;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    padding: 0.5rem var(--gutter) 1.5rem;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-0.5rem);
    transition: opacity 0.25s, transform 0.3s var(--ease), visibility 0s 0.3s;
  }
  .nav-open .site-nav { visibility: visible; opacity: 1; transform: none; transition-delay: 0s; }
  .site-nav ul { flex-direction: column; gap: 0; }
  .site-nav li + li { border-top: 1px solid var(--rule); }
  .site-nav a { display: block; padding-block: 0.9rem; font-family: var(--font-display); font-size: 1.375rem; background: none; }
}

@media (max-width: 36rem) {
  .gems { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .details-row { grid-template-columns: minmax(0, 1fr); gap: 0.15rem; }
  .actions .btn { flex: 1 1 100%; }
  .footer-grid { grid-template-columns: minmax(0, 1fr); }
}
