/* இலக்கம் — ஒளியோன் ஆய்வகம் */

/* ---------- Fonts (self-hosted, SIL Open Font Licence) ---------- */
@font-face { font-family: 'Noto Sans Tamil'; font-weight: 400; font-display: swap; src: url(../fonts/noto-sans-tamil-tamil-400-normal.woff2) format('woff2'); unicode-range: U+0964-0965, U+0B82-0BFA, U+200C-200D, U+20B9, U+25CC; }
@font-face { font-family: 'Noto Sans Tamil'; font-weight: 500; font-display: swap; src: url(../fonts/noto-sans-tamil-tamil-500-normal.woff2) format('woff2'); unicode-range: U+0964-0965, U+0B82-0BFA, U+200C-200D, U+20B9, U+25CC; }
@font-face { font-family: 'Noto Sans Tamil'; font-weight: 700; font-display: swap; src: url(../fonts/noto-sans-tamil-tamil-700-normal.woff2) format('woff2'); unicode-range: U+0964-0965, U+0B82-0BFA, U+200C-200D, U+20B9, U+25CC; }
@font-face { font-family: 'Noto Sans Tamil'; font-weight: 400; font-display: swap; src: url(../fonts/noto-sans-tamil-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Noto Sans Tamil'; font-weight: 500; font-display: swap; src: url(../fonts/noto-sans-tamil-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Noto Sans Tamil'; font-weight: 700; font-display: swap; src: url(../fonts/noto-sans-tamil-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Noto Sans Tamil'; font-weight: 400; font-display: swap; src: url(../fonts/noto-sans-tamil-latin-ext-400-normal.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Noto Sans Tamil'; font-weight: 500; font-display: swap; src: url(../fonts/noto-sans-tamil-latin-ext-500-normal.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Noto Sans Tamil'; font-weight: 700; font-display: swap; src: url(../fonts/noto-sans-tamil-latin-ext-700-normal.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Arima'; font-weight: 600; font-display: swap; src: url(../fonts/arima-tamil-600-normal.woff2) format('woff2'); unicode-range: U+0964-0965, U+0B82-0BFA, U+200C-200D, U+20B9, U+25CC; }
@font-face { font-family: 'Arima'; font-weight: 700; font-display: swap; src: url(../fonts/arima-tamil-700-normal.woff2) format('woff2'); unicode-range: U+0964-0965, U+0B82-0BFA, U+200C-200D, U+20B9, U+25CC; }
@font-face { font-family: 'Arima'; font-weight: 600; font-display: swap; src: url(../fonts/arima-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Arima'; font-weight: 700; font-display: swap; src: url(../fonts/arima-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Tamil Fractions'; font-weight: 400; font-display: swap; src: url(../fonts/noto-sans-tamil-supplement-tamil-supplement-400-normal.woff2) format('woff2'); unicode-range: U+11FC0-11FFF; }

/* ---------- Tokens ---------- */
:root {
  --ink: #001f5b;
  --ink-2: #33456e;
  --ink-3: #5d6b8a;
  --flame: #f0a003;
  --flame-text: #8f5600; /* gold that passes contrast on white */
  --olai: #e9d5a1;
  --olai-2: #dcc386;
  --olai-ink: #3b2a14;
  --paper: #ffffff;
  --mist: #f2f5fa;
  --line: #dbe1ec;
  --ok: #1d6b45;
  --warn: #8a4b00;
  --error: #a3261c;

  --f-body: 'Noto Sans Tamil', 'Tamil Fractions', system-ui, sans-serif;
  --f-display: 'Arima', 'Noto Sans Tamil', 'Tamil Fractions', serif;
  --f-frac: 'Tamil Fractions', 'Noto Sans Tamil', sans-serif;

  --step--1: 0.8125rem;
  --step-0: 1rem;
  --step-1: 1.1875rem;
  --step-2: 1.5rem;
  --step-3: clamp(1.6rem, 2.5vw + 0.9rem, 2.125rem);
  --step-4: clamp(2.75rem, 6vw, 4.25rem);

  --wrap: 72rem;
  --gutter: clamp(1rem, 4vw, 2rem);
  --radius-s: 6px;
  --radius-m: 12px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--f-body);
  font-size: var(--step-0);
  line-height: 1.75;
  color: var(--ink);
  background: var(--paper);
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-underline-offset: 0.2em; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 700; line-height: 1.3; margin: 0; overflow-wrap: break-word; }
p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--flame); outline-offset: 3px; border-radius: 4px; }
.frac, .glyphs { font-family: var(--f-frac); }
.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: 0.5rem 1rem; z-index: 50; }
.skip:focus { left: 1rem; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Language switching: Tamil is the default */
html[data-lang='ta'] .en { display: none !important; }
html[data-lang='en'] .ta { display: none !important; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header__row { display: flex; align-items: center; gap: 1.5rem; min-height: 4.5rem; }
.brand { display: flex; align-items: center; flex: none; }
.brand img { height: 3.25rem; width: auto; }
.nav { margin-left: auto; display: flex; align-items: center; gap: 0.25rem; }
.nav a {
  text-decoration: none; font-weight: 500; font-size: 0.875rem;
  padding: 0.5rem 0.75rem; border-radius: var(--radius-s); color: var(--ink-2);
}
.nav a:hover { background: var(--mist); color: var(--ink); }
.nav a[aria-current='page'] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--flame); border-radius: 0; }
.lang-toggle {
  border: 1px solid var(--line); background: var(--paper); border-radius: 999px;
  padding: 0.35rem 0.9rem; font-size: var(--step--1); font-weight: 500; cursor: pointer;
}
.lang-toggle:hover { border-color: var(--ink-3); }
.menu-btn { display: none; margin-left: auto; border: 0; background: none; padding: 0.5rem; cursor: pointer; }
.menu-btn svg { width: 1.6rem; height: 1.6rem; }

@media (max-width: 68rem) {
  .menu-btn { display: block; }
  .nav {
    display: none; position: absolute; inset: 100% 0 auto 0; flex-direction: column; align-items: stretch;
    background: var(--paper); border-bottom: 1px solid var(--line); padding: 0.5rem var(--gutter) 1rem; gap: 0;
  }
  .nav.is-open { display: flex; }
  .nav a { font-size: var(--step-0); padding: 0.75rem 0; border-radius: 0; border-bottom: 1px solid var(--mist); }
  .nav a[aria-current='page'] { box-shadow: inset 3px 0 0 var(--flame); padding-left: 0.75rem; }
  .lang-toggle { margin-top: 0.75rem; align-self: flex-start; }
  .brand img { height: 2.75rem; }
}

/* ---------- Flame ---------- */
.flame { position: relative; display: grid; place-items: center; }
.flame__glow {
  position: absolute; inset: 15% 5% 0; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(240, 160, 3, 0.38), rgba(240, 160, 3, 0) 70%);
  filter: blur(6px);
  animation: glow 3.2s ease-in-out infinite;
}
.flame__shape { position: relative; transform-origin: 50% 100%; animation: flicker 3.2s ease-in-out infinite; }
.flame__shape path { fill: var(--flame); }
@keyframes flicker {
  0%, 100% { transform: scale(1, 1) skewX(0deg); }
  20% { transform: scale(0.985, 1.025) skewX(-1.2deg); }
  45% { transform: scale(1.01, 0.985) skewX(0.8deg); }
  70% { transform: scale(0.99, 1.03) skewX(1.4deg); }
}
@keyframes glow {
  0%, 100% { opacity: 0.75; transform: scale(1); }
  45% { opacity: 1; transform: scale(1.06); }
  70% { opacity: 0.85; transform: scale(0.97); }
}

/* ---------- Hero ---------- */
.hero { text-align: center; padding: clamp(1rem, 3vw, 2rem) 0 clamp(2.5rem, 6vw, 4rem); }
.hero__light { position: relative; width: min(100%, 40rem); margin: 0 auto 0.5rem; }
.halo { width: 100%; height: auto; overflow: visible; }
.halo__n { font-family: var(--f-display); font-weight: 700; font-size: 25px; fill: var(--ink); text-anchor: middle; dominant-baseline: middle; opacity: 0.32; animation: light-up 0.9s ease-out both; animation-delay: calc(var(--i) * 70ms + 300ms); }
.halo__n.frac { font-family: var(--f-frac); font-weight: 400; fill: var(--flame-text); }
.halo__n.is-apex { fill: var(--flame); opacity: 0.95; font-size: 30px; }
.halo__ray { stroke: var(--flame); stroke-width: 1; stroke-linecap: round; opacity: 0.16; animation: ray 0.9s ease-out both; animation-delay: calc(var(--i) * 70ms + 300ms); }
@keyframes light-up { 0% { opacity: 0; } 45% { opacity: 1; fill: var(--flame); } 100% { } }
@keyframes ray { 0% { opacity: 0; } 45% { opacity: 0.55; } 100% { opacity: 0.16; } }
.hero__flame { position: absolute; left: 50%; bottom: 0; width: clamp(4.2rem, 13vw, 6.6rem); transform: translateX(-50%); }
.hero__ladder { max-width: 40rem; margin: 1.1rem auto 0; font-family: var(--f-display); font-weight: 600; font-size: var(--step-1); color: var(--flame-text); line-height: 1.5; }
.hero__brand { font-family: var(--f-display); font-weight: 700; font-size: var(--step-3); line-height: 1.2; color: var(--ink); }
.hero__tagline { font-family: var(--f-display); font-weight: 600; font-size: var(--step-1); color: var(--flame-text); margin-top: 0.25rem; }
.hero__lockup {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: clamp(0.75rem, 3vw, 1.75rem);
  max-width: 44rem; margin: clamp(1.75rem, 4vw, 2.5rem) auto 0;
}
.hero__lockup::before, .hero__lockup::after { content: ''; height: 3px; background: var(--ink); border-radius: 2px; }
.hero__title { font-size: var(--step-4); color: var(--ink); line-height: 1.15; }
.hero__title .en { font-size: 0.8em; }
.hero__lede { max-width: 40rem; margin: 1.25rem auto 0; font-size: var(--step-1); line-height: 1.7; color: var(--ink-2); }
.hero__lede .ta { font-size: 0.92em; }
.hero__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; margin-top: 2rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 3rem; padding: 0.6rem 1.4rem; border-radius: 999px; font-weight: 500;
  text-decoration: none; border: 2px solid var(--ink); cursor: pointer;
}
.btn--primary { background: var(--ink); color: #fff; }
.btn--primary:hover { background: #00307f; border-color: #00307f; }
.btn--ghost { background: transparent; color: var(--ink); }
.btn--ghost:hover { background: var(--mist); }

/* ---------- Sections ---------- */
.section { padding: clamp(3rem, 8vw, 5.5rem) 0; }
.section--mist { background: var(--mist); }
.section__head { max-width: 46rem; margin-bottom: clamp(1.75rem, 4vw, 2.75rem); }
.section__head h2 { font-size: var(--step-3); }
.section__head p { margin-top: 0.75rem; color: var(--ink-2); font-size: var(--step-1); line-height: 1.65; }
.section__head p .ta { font-size: 0.92em; }

/* ---------- Olai (palm-leaf) strip — the signature surface ---------- */
.olai {
  position: relative;
  background:
    repeating-linear-gradient(180deg, rgba(120, 86, 30, 0.06) 0 1px, transparent 1px 7px),
    linear-gradient(180deg, #efdeae, var(--olai) 55%, #e2cb8f);
  color: var(--olai-ink);
  border-radius: 28px / 50%;
  padding: clamp(1.5rem, 4vw, 2.25rem) clamp(3.25rem, 9vw, 6.5rem);
  box-shadow: inset 0 0 0 1px rgba(120, 86, 30, 0.18), 0 18px 40px -26px rgba(59, 42, 20, 0.55);
}
.olai::before, .olai::after {
  content: ''; position: absolute; top: 50%; width: 0.9rem; height: 0.9rem; margin-top: -0.45rem; border-radius: 50%;
  background: var(--paper); box-shadow: inset 0 1px 2px rgba(59, 42, 20, 0.45);
}
.olai::before { left: clamp(1.25rem, 3.5vw, 2.4rem); }
.olai::after { right: clamp(1.25rem, 3.5vw, 2.4rem); }
.section--mist .olai::before, .section--mist .olai::after { background: var(--mist); }
@media (max-width: 40rem) {
  .olai { border-radius: 20px; padding: 1.5rem 2.5rem; }
  .olai::before, .olai::after { top: 1.25rem; margin-top: 0; }
  .olai::before { left: 0.9rem; }
  .olai::after { right: 0.9rem; }
  .hero__actions .btn { width: 100%; }
  .olai-out__line b { display: block; margin: 0; }
}

/* ---------- Try-it demo ---------- */
.demo { display: grid; gap: 1.25rem; }
.demo__input-row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.field {
  flex: 1 1 18rem; min-height: 3.5rem; padding: 0.6rem 1.1rem; border: 2px solid var(--line);
  border-radius: var(--radius-m); background: var(--paper); font-size: var(--step-1);
}
.field:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 4px rgba(240, 160, 3, 0.35); }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: 0.3rem 0.9rem;
  font-size: var(--step--1); cursor: pointer; color: var(--ink-2);
}
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.olai-out { display: grid; gap: 0.35rem; min-height: 9rem; align-content: center; }
.olai-out__big { font-family: var(--f-display); font-weight: 700; font-size: clamp(1.6rem, 4.5vw, 2.75rem); line-height: 1.3; word-break: break-word; }
.olai-out__line { font-size: var(--step-1); line-height: 1.6; }
.olai-out__line b { font-weight: 500; opacity: 0.7; margin-right: 0.5rem; font-size: var(--step--1); }
.olai-out__error { color: var(--error); font-weight: 500; }

/* ---------- About ---------- */
.about { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: clamp(2rem, 6vw, 4.5rem); align-items: start; }
.about__text { display: grid; gap: 1.1rem; max-width: 40rem; color: var(--ink-2); }
.about__text h2 { font-size: var(--step-3); color: var(--ink); }
.signs { border-top: 3px solid var(--ink); }
.signs h3 { font-size: var(--step-1); padding: 1rem 0 0.5rem; }
.signs dl { margin: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr) auto; column-gap: 1rem; }
.signs__row { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: baseline; padding: 0.55rem 0; border-bottom: 1px solid var(--line); }
@supports not (grid-template-columns: subgrid) { .signs__row { grid-template-columns: 5.5rem minmax(0, 1fr) auto; column-gap: 1rem; } }
.signs__row dt { font-family: var(--f-display); font-size: var(--step-2); line-height: 1.2; color: var(--ink); white-space: nowrap; }
.signs__row dt.frac { font-family: var(--f-frac); }
.signs__row dd { margin: 0; }
.signs__row .val { color: var(--ink-3); font-variant-numeric: tabular-nums; text-align: right; }
@media (max-width: 52rem) { .about { grid-template-columns: 1fr; } }

/* ---------- Features ---------- */
.features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: clamp(2rem, 6vw, 4.5rem); }
.feature { padding: 1.5rem 0; border-top: 1px solid var(--line); display: grid; gap: 0.5rem; align-content: start; }
.feature h3 { font-size: var(--step-1); font-family: var(--f-body); font-weight: 700; }
.feature p { color: var(--ink-2); }
.feature__eg {
  justify-self: start; margin-top: 0.35rem; background: var(--olai); color: var(--olai-ink);
  border-radius: var(--radius-s); padding: 0.2rem 0.75rem; font-family: var(--f-display); font-weight: 600; font-size: var(--step-0);
}
@media (max-width: 46rem) { .features { grid-template-columns: 1fr; } }

/* ---------- Coming next ---------- */
.next { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.5rem; }
.next__item { border-left: 3px solid var(--olai-2); padding: 0.25rem 0 0.25rem 1rem; }
.next__item h3 { font-family: var(--f-body); font-size: var(--step-0); font-weight: 700; }
.next__item p { color: var(--ink-3); font-size: var(--step--1); line-height: 1.65; margin-top: 0.25rem; }
@media (max-width: 60rem) { .next { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 34rem) { .next { grid-template-columns: 1fr; } }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: #dfe6f5; padding: clamp(3rem, 7vw, 4.5rem) 0 2rem; }
.site-footer a { color: #fff; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.footer__grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 2rem; }
.footer__brand { display: grid; gap: 0.75rem; align-content: start; }
.footer__brand .flame { width: 2.4rem; justify-items: start; }
.footer__brand .flame__glow { display: none; }
.footer__name { font-family: var(--f-display); font-weight: 700; font-size: var(--step-2); color: #fff; line-height: 1.25; }
.footer__brand p { color: #b9c4dc; max-width: 22rem; }
.footer__col h2 { font-family: var(--f-body); font-size: var(--step--1); font-weight: 700; color: var(--flame); margin-bottom: 0.75rem; }
.footer__col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.45rem; }
.footer__bottom { margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid rgba(255, 255, 255, 0.14); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.75rem; font-size: var(--step--1); color: #9fb0d0; }
@media (max-width: 56rem) { .footer__grid { grid-template-columns: 1fr 1fr; } .footer__brand { grid-column: 1 / -1; } }
@media (max-width: 30rem) { .footer__grid { grid-template-columns: 1fr; } }

/* ---------- Tool pages ---------- */
.page-head { padding-block: clamp(2rem, 5vw, 3rem) 1.5rem; }
.page-head h1 { font-size: var(--step-3); }
.page-head p { color: var(--ink-2); margin-top: 0.5rem; max-width: 44rem; }

.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--line); margin-bottom: 1.75rem; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; white-space: nowrap;
  border: 0; background: none; padding: 0.75rem 1.1rem; font-weight: 500; color: var(--ink-3); cursor: pointer;
  border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.tab[aria-selected='true'] { color: var(--ink); border-bottom-color: var(--flame); }
.tab:hover { color: var(--ink); }
@media (max-width: 40rem) {
  /* On phones every tab stays visible: wrap them as pills instead of a sideways strip. */
  .tabs { flex-wrap: wrap; overflow: visible; border-bottom: 0; gap: 0.5rem; }
  .tab { border: 1px solid var(--line); border-radius: 999px; padding: 0.5rem 1rem; margin: 0; }
  .tab[aria-selected='true'] { background: var(--ink); border-color: var(--ink); color: #fff; }
}

.workbench { display: grid; grid-template-columns: minmax(0, 26rem) minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 3rem); align-items: start; padding-bottom: 4rem; }
@media (max-width: 60rem) { .workbench { grid-template-columns: 1fr; } }

.calc { background: var(--mist); border-radius: var(--radius-m); padding: 1rem; display: grid; gap: 0.9rem; }
.calc__screen { background: var(--paper); border: 2px solid var(--line); border-radius: var(--radius-m); padding: 0.6rem 0.9rem; }
.calc__screen:focus-within { border-color: var(--ink); }
.calc__input {
  width: 100%; border: 0; outline: none; background: none; text-align: right;
  font-family: var(--f-display); font-weight: 600; font-size: clamp(1.5rem, 5vw, 1.9rem); line-height: 1.4; padding: 0;
}
.calc__preview { text-align: right; color: var(--ink-3); min-height: 1.75rem; font-size: var(--step-0); overflow-wrap: anywhere; }
.calc__preview.is-error { color: var(--error); }
.keys { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.5rem; }
.key {
  min-height: 3.4rem; border: 1px solid var(--line); background: var(--paper); border-radius: var(--radius-s);
  font-family: var(--f-display); font-weight: 600; font-size: 1.3rem; line-height: 1; cursor: pointer;
  display: grid; place-items: center; align-content: center; gap: 0.15rem; touch-action: manipulation; user-select: none;
}
.key small { font-family: var(--f-body); font-size: 0.7rem; font-weight: 400; color: var(--ink-3); }
.key:hover { border-color: var(--ink-3); }
.key:active { transform: translateY(1px); }
.key--sign { color: var(--flame-text); }
.key--op { background: #e6ebf5; }
.key--eq { background: var(--ink); color: #fff; border-color: var(--ink); }
.key--eq:hover { background: #00307f; }
.key--util { font-family: var(--f-body); font-size: 1rem; font-weight: 500; color: var(--ink-2); }

.fracpad > summary { cursor: pointer; font-weight: 500; padding: 0.35rem 0.1rem; list-style: none; display: flex; align-items: center; gap: 0.5rem; }
.fracpad > summary::-webkit-details-marker { display: none; }
.fracpad > summary::before { content: '+'; display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: var(--ink); color: #fff; font-size: 1rem; line-height: 1; }
.fracpad[open] > summary::before { content: '−'; }
.fracpad__keys { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.4rem; margin-top: 0.6rem; }
.fkey {
  border: 1px solid var(--olai-2); background: var(--olai); color: var(--olai-ink); border-radius: var(--radius-s);
  padding: 0.45rem 0.3rem 0.4rem; cursor: pointer; display: grid; justify-items: center; align-content: start; gap: 0.2rem; text-align: center;
  touch-action: manipulation; min-width: 0;
}
.fkey:hover { border-color: var(--olai-ink); }
.fkey .glyphs { font-size: 1.55rem; line-height: 1.25; }
.fkey span:last-child { font-size: 0.74rem; line-height: 1.3; overflow-wrap: anywhere; }
.fkey em { font-style: normal; display: block; color: rgba(59, 42, 20, 0.7); }

.results { display: grid; gap: 0; }
.results__empty { color: var(--ink-3); padding: 1.5rem 0; }
.result-row { display: grid; grid-template-columns: 11rem minmax(0, 1fr) auto; gap: 1rem; align-items: baseline; padding: 0.9rem 0; border-bottom: 1px solid var(--line); }
.result-row:first-child { border-top: 3px solid var(--ink); }
.result-row__label { color: var(--ink-3); font-size: var(--step--1); font-weight: 500; }
.result-row__value { font-size: var(--step-1); line-height: 1.55; overflow-wrap: anywhere; }
.result-row__value.is-big { font-family: var(--f-display); font-weight: 700; font-size: var(--step-2); line-height: 1.35; }
.result-row__note { display: block; font-size: var(--step--1); color: var(--warn); margin-top: 0.25rem; }
.copy {
  border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: 0.15rem 0.75rem;
  font-size: 0.8rem; cursor: pointer; color: var(--ink-2); white-space: nowrap;
}
.copy:hover { border-color: var(--ink-3); color: var(--ink); }
.row-actions { display: inline-flex; gap: 0.35rem; align-items: center; }
.speak {
  display: inline-grid; place-items: center; width: 2rem; height: 1.75rem; padding: 0; flex: none;
  border: 1px solid var(--line); background: var(--paper); border-radius: 999px; color: var(--ink-2); cursor: pointer;
  vertical-align: middle;
}
.speak svg { width: 1.05rem; height: 1.05rem; }
.speak:hover { border-color: var(--ink-3); color: var(--ink); }
.speak.is-on { background: var(--ink); border-color: var(--ink); color: #fff; }
.olai-out__line .speak { margin-left: 0.5rem; background: rgba(255, 255, 255, 0.55); border-color: rgba(120, 86, 30, 0.35); color: var(--olai-ink); }
@media (max-width: 34rem) {
  .result-row { grid-template-columns: minmax(0, 1fr) auto; gap: 0.25rem 0.75rem; }
  .result-row__label { grid-column: 1 / -1; }
}
.terms { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.term { background: var(--olai); color: var(--olai-ink); border-radius: var(--radius-s); padding: 0.1rem 0.6rem; font-size: var(--step--1); display: inline-flex; gap: 0.4rem; align-items: baseline; }
.term .glyphs { font-size: 1.15rem; }
.term--lower { background: #f3e8c8; }
.options { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; margin-top: 1rem; color: var(--ink-2); font-size: var(--step--1); }
.options label { display: inline-flex; gap: 0.4rem; align-items: center; cursor: pointer; }
.options input { width: 1.1rem; height: 1.1rem; accent-color: var(--ink); }

.history { margin-top: 2rem; }
.history h2 { font-family: var(--f-body); font-size: var(--step-0); font-weight: 700; display: flex; justify-content: space-between; align-items: baseline; }
.history ol { list-style: none; margin: 0.5rem 0 0; padding: 0; }
.history li button {
  width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 0.55rem 0; cursor: pointer;
  display: flex; justify-content: space-between; gap: 1rem; color: var(--ink-2);
}
.history li button:hover { color: var(--ink); }
.history li b { font-weight: 500; color: var(--ink); }
.linkish { border: 0; background: none; padding: 0; color: var(--ink-3); font-size: var(--step--1); text-decoration: underline; cursor: pointer; }

.convert { display: grid; gap: 1rem; }
.convert textarea { min-height: 7rem; resize: vertical; font-family: var(--f-display); font-weight: 600; font-size: var(--step-2); line-height: 1.4; }
.convert textarea::placeholder { font-family: var(--f-body); font-weight: 400; font-size: var(--step-0); line-height: 1.6; color: var(--ink-3); }
.steps { margin: 1rem 0 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 2rem 1fr; gap: 0.5rem; padding: 0.5rem 0; border-bottom: 1px dashed var(--line); }
.steps li::before { content: counter(step); font-weight: 700; color: var(--flame-text); }
.steps__title { margin-top: 2rem; font-family: var(--f-body); font-size: var(--step-0); }
.steps__total { margin-top: 0.75rem; font-weight: 700; }
.steps .glyphs, .steps .tn { font-family: var(--f-display); font-weight: 700; font-size: 1.15em; }
.warning { background: #fff4e0; border-left: 3px solid var(--flame); padding: 0.6rem 0.9rem; color: var(--warn); border-radius: 0 var(--radius-s) var(--radius-s) 0; margin-top: 1rem; }

/* ---------- Fraction table ---------- */
.ftable-wrap { overflow-x: auto; margin-bottom: 1.5rem; }
.ftable { width: 100%; border-collapse: collapse; min-width: 40rem; }
.ftable caption { text-align: left; font-weight: 700; padding-bottom: 0.75rem; }
.ftable th, .ftable td { text-align: left; padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ftable thead th { font-size: var(--step--1); color: var(--ink-3); font-weight: 500; border-bottom: 3px solid var(--ink); }
.ftable td.num { font-variant-numeric: tabular-nums; }
.ftable .glyph-cell { width: 5rem; }
.ftable .glyph-chip { border: 0; cursor: pointer; display: inline-grid; place-items: center; min-width: 3rem; padding: 0 0.35rem; height: 3rem; background: var(--olai); color: var(--olai-ink); border-radius: var(--radius-s); font-size: 1.7rem; line-height: 1; }
.ftable .name { display: block; font-family: var(--f-display); font-weight: 700; font-size: var(--step-1); line-height: 1.4; }
.ftable .alias { display: block; font-size: var(--step--1); color: var(--ink-3); }
.ftable .tr { color: var(--ink-3); font-size: var(--step--1); }
.ftable tr.kiizh td { background: #fbf6e8; }
.notes { display: grid; gap: 1rem; max-width: 46rem; color: var(--ink-2); padding-bottom: 4rem; }
.notes h2 { font-size: var(--step-2); color: var(--ink); margin-top: 1rem; }

.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 1rem); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; padding: 0.55rem 1.1rem; border-radius: var(--radius-m); font-size: var(--step--1);
  max-width: min(34rem, calc(100vw - 2rem)); width: max-content; text-align: center; line-height: 1.5;
  transition: opacity 0.2s, transform 0.2s; z-index: 60;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

.notfound { text-align: center; padding: 5rem 0; display: grid; gap: 1rem; justify-items: center; }
.notfound .flame { width: 4rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}


/* ---------- Home: sections as links ---------- */
a.feature--link { text-decoration: none; color: inherit; border-radius: var(--radius-s); }
a.feature--link h3 { color: var(--ink); }
a.feature--link h3::after { content: ' ›'; color: var(--flame-text); }
a.feature--link:hover h3 { text-decoration: underline; text-underline-offset: 0.2em; }

/* ---------- Generic blocks, tables, forms ---------- */
.subnav { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; padding: 0 0 1.25rem; margin-bottom: 0.5rem; border-bottom: 1px solid var(--line); }
.subnav a { font-weight: 500; color: var(--ink-2); text-decoration: none; }
.subnav a:hover { color: var(--ink); text-decoration: underline; }
.block { padding: 2.25rem 0 1rem; scroll-margin-top: 5rem; }
.block h2 { font-size: var(--step-2); margin-bottom: 0.5rem; }
.block h3 { font-family: var(--f-body); font-size: var(--step-1); font-weight: 700; margin: 2rem 0 0.4rem; scroll-margin-top: 5rem; }
.lead { color: var(--ink-2); max-width: 46rem; margin-bottom: 1rem; }
.hint { color: var(--ink-3); font-size: var(--step--1); }
.table-wrap { overflow-x: auto; margin: 0.75rem 0 1.5rem; }
.table { width: 100%; border-collapse: collapse; min-width: 34rem; }
.table th, .table td { text-align: left; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table thead th { font-size: var(--step--1); color: var(--ink-3); font-weight: 500; border-bottom: 3px solid var(--ink); white-space: nowrap; }
.table .tn { font-family: var(--f-display); font-weight: 700; font-size: var(--step-1); white-space: nowrap; }
.table .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .sub { display: block; color: var(--ink-3); font-size: var(--step--1); }
.table .fixed { color: var(--warn); font-size: var(--step--1); display: block; }
.table--tight td { padding: 0.4rem 0.75rem; }
.table tr.is-current td { background: #fff4e0; }
.notes-list { margin: 0.5rem 0 2rem; padding-left: 1.2rem; display: grid; gap: 0.75rem; max-width: 50rem; color: var(--ink-2); }
.sign-group h3 { margin-top: 1.5rem; }
.sign-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr)); gap: 0.6rem; margin-top: 0.75rem; }
.sign-card { display: grid; grid-template-columns: 3rem 1fr; gap: 0.25rem 0.75rem; align-items: center; text-align: left; border: 1px solid var(--line); background: var(--paper); border-radius: var(--radius-s); padding: 0.5rem 0.6rem; cursor: pointer; }
.sign-card:hover { border-color: var(--ink-3); }
.sign-card .glyph-chip { grid-row: span 2; display: grid; place-items: center; height: 2.8rem; background: var(--olai); color: var(--olai-ink); border-radius: var(--radius-s); font-size: 1.6rem; line-height: 1; font-family: var(--f-display); }
.sign-card .glyph-chip.frac { font-family: var(--f-frac); }
.sign-card b { font-weight: 700; font-size: var(--step-0); line-height: 1.3; }
.sign-card small { color: var(--ink-3); font-size: 0.78rem; line-height: 1.35; }

.stack { display: grid; gap: 0.75rem; align-content: start; }
.workbench--even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 60rem) { .workbench--even { grid-template-columns: 1fr; } }
.field--text { min-height: 12rem; resize: vertical; font-size: var(--step-0); line-height: 1.7; }
.field--big { min-height: 7rem; resize: vertical; font-family: var(--f-display); font-weight: 600; font-size: var(--step-2); line-height: 1.4; }
.field--big::placeholder { font-family: var(--f-body); font-weight: 400; font-size: var(--step-0); line-height: 1.6; color: var(--ink-3); }
.field--select { flex: none; min-height: 2.9rem; padding: 0.35rem 0.8rem; font-size: var(--step-0); background: var(--paper); }
.radios { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }
.radios legend { font-weight: 700; margin-bottom: 0.35rem; padding: 0; width: 100%; }
.radios label, .form-grid .radios label { display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer; font-weight: 400; }
.radios input { width: 1.1rem; height: 1.1rem; accent-color: var(--ink); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1rem; align-items: end; margin: 1rem 0; }
.form-grid label { display: grid; gap: 0.35rem; font-weight: 500; }
.form-grid .field { flex: none; width: 100%; }
.answer { display: block; font-family: var(--f-display); font-weight: 700; font-size: var(--step-1); line-height: 1.5; padding: 0.4rem 0; }
.answer small { display: block; font-family: var(--f-body); font-weight: 400; font-size: var(--step--1); color: var(--ink-3); }
.inline-label { display: inline-flex; gap: 0.75rem; align-items: center; font-weight: 500; flex-wrap: wrap; }
.olai--line { border-radius: 18px; padding: 1rem 3rem; font-family: var(--f-display); font-weight: 700; font-size: var(--step-2); display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; justify-content: space-between; }
.olai--line .copy { font-family: var(--f-body); }

/* ---------- Measures ---------- */
.measure { display: grid; gap: 1rem; padding: 0.5rem 0 3rem; }
.measure__inputs { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: end; }
.measure__inputs label { display: grid; gap: 0.35rem; font-weight: 500; }
.measure__inputs .field { flex: none; min-width: 9rem; height: 3.4rem; box-sizing: border-box; margin: 0; }
.measure__tiny summary { cursor: pointer; font-weight: 500; color: var(--ink-2); }
.measure__inputs .field--qty { width: 12rem; font-family: var(--f-display); font-weight: 600; font-size: var(--step-1); }
.measure__error { color: var(--error); font-weight: 500; min-height: 1.5rem; }
.measure .unit-sign { font-family: var(--f-frac); color: var(--flame-text); margin-left: 0.35rem; }
.measure tr.is-from td { background: #fff4e0; }
.measure tr.is-modern td:first-child { color: var(--ink-2); }
.measure .chain { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.measure .chain li { background: var(--mist); border-radius: var(--radius-s); padding: 0.2rem 0.65rem; font-size: var(--step--1); }
.measure .note, .block > .note { color: var(--ink-2); font-size: var(--step--1); max-width: 52rem; border-left: 3px solid var(--olai-2); padding-left: 0.9rem; margin-top: 1rem; }

/* ---------- Year cycle ---------- */
.cycle summary { cursor: pointer; font-weight: 500; }
.cycle__list { columns: 4 12rem; margin: 0.75rem 0 1rem; padding-left: 2rem; }
.cycle__list li { padding: 0.15rem 0; }
.cycle__list li.is-current { font-weight: 700; color: var(--flame-text); }

/* ---------- Quiz ---------- */
.quiz { max-width: 40rem; display: grid; gap: 1rem; margin: 1rem 0 3rem; }
.quiz__q { font-family: var(--f-display); font-weight: 700; font-size: var(--step-2); line-height: 1.35; }
.quiz__q .frac { font-family: var(--f-frac); font-weight: 400; }
.quiz__meta { color: var(--ink-3); font-size: var(--step--1); }
.quiz__opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
.quiz__opt { min-height: 3.4rem; border: 1px solid var(--line); background: var(--paper); border-radius: var(--radius-s); font-family: var(--f-display); font-weight: 600; font-size: var(--step-1); cursor: pointer; padding: 0.4rem 0.6rem; }
.quiz__opt:hover:not(:disabled) { border-color: var(--ink-3); }
.quiz__opt.is-right { background: #e3f3ea; border-color: var(--ok); }
.quiz__opt.is-wrong { background: #fbe7e5; border-color: var(--error); }
.quiz__opt .frac { font-family: var(--f-frac); font-weight: 400; }
.quiz__feedback { min-height: 1.6rem; font-weight: 500; }
.quiz__feedback.is-right { color: var(--ok); }
.quiz__feedback.is-wrong { color: var(--error); }
@media (max-width: 30rem) { .quiz__opts { grid-template-columns: 1fr; } }

/* ---------- Tamil calendar ---------- */
.cal-form { grid-template-columns: repeat(auto-fit, minmax(12rem, max-content)); }
.cal-step { display: flex; gap: 0.4rem; align-items: end; }
.cal-step .btn, .cal-month__head .btn { position: relative; }
.cal-step .btn { min-height: 2.9rem; padding-inline: 1rem; }
.cal-day { margin: 0.5rem 0 1rem; display: grid; gap: 0.2rem; }
.cal-day__big { font-family: var(--f-display); font-weight: 700; font-size: var(--step-3); line-height: 1.25; display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.5rem; }
.cal-day__num { font-family: var(--f-body); font-weight: 400; font-size: var(--step-0); opacity: 0.75; }
.cal-day__big .speak { background: rgba(255, 255, 255, 0.55); border-color: rgba(120, 86, 30, 0.35); color: var(--olai-ink); }
.cal-day__sub { font-size: var(--step-0); }
.cal-month { margin-top: 2rem; max-width: 40rem; }
.cal-month__head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.cal-month__head h3 { font-family: var(--f-body); font-size: var(--step-0); font-weight: 700; text-align: center; margin: 0; }
.cal-month__head .btn { min-height: 2.5rem; padding-inline: 0.9rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.3rem; }
.cal-grid__head { text-align: center; font-size: var(--step--1); color: var(--ink-3); font-weight: 500; padding-bottom: 0.2rem; }
.cal-cell {
  position: relative; display: grid; justify-items: center; align-content: center; gap: 0; min-height: 3.6rem; padding: 0.3rem 0.1rem;
  border: 1px solid var(--line); background: var(--paper); border-radius: var(--radius-s); cursor: pointer; color: var(--ink);
}
.cal-cell:hover { border-color: var(--ink-3); }
.cal-cell__ta { font-family: var(--f-display); font-weight: 700; font-size: var(--step-1); line-height: 1.2; }
.cal-cell__greg { font-size: 0.72rem; color: var(--ink-3); line-height: 1.2; }
.cal-cell__moon { position: absolute; top: 0.2rem; right: 0.3rem; font-size: 0.7rem; line-height: 1; color: var(--flame-text); }
.cal-cell.is-sunday .cal-cell__ta { color: var(--error); }
.cal-cell.is-today { border-color: var(--flame); box-shadow: inset 0 0 0 1px var(--flame); }
.cal-cell.is-selected { background: var(--ink); border-color: var(--ink); color: #fff; }
.cal-cell.is-selected .cal-cell__ta, .cal-cell.is-selected .cal-cell__greg, .cal-cell.is-selected .cal-cell__moon { color: #fff; }
.cal-legend { font-size: var(--step--1); color: var(--ink-3); margin-top: 0.5rem; }

/* ---------- Kanakkathikaram puzzles ---------- */
.pz-list { display: grid; gap: 2.5rem; margin: 1.25rem 0 1rem; }
.pz { border-top: 1px solid var(--line); padding-top: 1.5rem; }
.pz h3 { font-size: var(--step-2); margin-bottom: 1rem; }
.pz-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(1.25rem, 4vw, 2.5rem); align-items: start; }
.pz-verse { margin: 0; display: grid; gap: 0.1rem; font-family: var(--f-display); font-weight: 600; font-size: var(--step-0); line-height: 1.65; }
.pz-verse.olai { padding: 1.25rem 2.75rem; border-radius: 18px; }
.pz-verse.olai::before { left: 1rem; }
.pz-verse.olai::after { right: 1rem; }
.pz-meaning { margin-top: 1rem; color: var(--ink-2); }
.pz-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 0.75rem; }
.pz-fields label { display: grid; gap: 0.3rem; font-weight: 500; font-size: var(--step--1); }
.pz-fields label { min-width: 0; align-content: end; }
.pz-fields .field { min-height: 2.9rem; font-size: var(--step-0); width: 100%; min-width: 0; flex: none; }
.pz-steps { margin: 1.1rem 0 0; padding-left: 1.4rem; display: grid; gap: 0.35rem; }
.pz-steps .tn { font-family: var(--f-display); }
.pz-answer { margin-top: 1rem; padding: 0.75rem 1rem; background: var(--mist); border-radius: var(--radius-m); display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.6rem; }
.pz-answer__label { font-size: var(--step--1); color: var(--ink-3); font-weight: 500; }
.pz-answer b { font-family: var(--f-display); font-size: var(--step-2); }
@media (max-width: 52rem) { .pz-body { grid-template-columns: 1fr; } }

/* ---------- Photo reading ---------- */
.photo-pick { justify-self: start; cursor: pointer; }
.photo-tips { margin: 0; padding-left: 1.2rem; display: grid; gap: 0.35rem; }
.photo-status { min-height: 1.5rem; font-weight: 500; color: var(--ink-2); }
.photo-view { border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; background: var(--mist); }
.photo-view canvas { display: block; width: 100%; height: auto; }
.photo-reading { color: var(--ink-2); }
#photo-numbers .result-row__label { font-family: var(--f-display); font-weight: 700; font-size: var(--step-1); color: var(--ink); }

/* ---------- Tamil typing and Seppam check ---------- */
.ti-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.4rem; }
.ti-modes, .share__kinds { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; background: var(--paper); }
.ti-mode { border: 0; background: none; border-radius: 999px; padding: 0.25rem 0.8rem; font-size: var(--step--1); color: var(--ink-2); cursor: pointer; font-weight: 500; }
.ti-mode[aria-pressed='true'] { background: var(--ink); color: #fff; }
.ti-check { border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: 0.25rem 0.85rem; font-size: var(--step--1); color: var(--ink); cursor: pointer; font-weight: 500; }
.ti-check:hover { border-color: var(--ink-3); }
.ti-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; min-height: 0; margin-top: 0.35rem; }
.ti-chips:empty { display: none; }
.ti-chips__label { font-size: var(--step--1); color: var(--ink-3); }
.chip.is-on { border-color: var(--ink); color: var(--ink); font-weight: 600; }
.ti-panel { margin-top: 0.6rem; padding: 0.75rem 0.9rem; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--mist); font-size: var(--step--1); display: grid; gap: 0.5rem; }
.ti-issues { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.ti-issues li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.ti-issue__word { font-weight: 700; color: var(--error); text-decoration: underline wavy rgba(163, 38, 28, 0.5); }
.ti-issue__msg { flex-basis: 100%; color: var(--ink-3); }
.ti-ok { color: var(--ok); font-weight: 600; }
.ti-credit { color: var(--ink-3); }

/* ---------- Share cards ---------- */
.share { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.share h3 { font-size: var(--step-2); margin-bottom: 0.35rem; }
.share__kinds { margin: 0.9rem 0 1rem; }
.share__body { display: grid; grid-template-columns: minmax(0, 22rem) minmax(0, 1fr); gap: clamp(1rem, 4vw, 2rem); align-items: start; }
.share__preview { width: 100%; height: auto; border-radius: var(--radius-m); box-shadow: 0 14px 34px -22px rgba(59, 42, 20, 0.6); background: var(--olai); }
.field--msg { min-height: 4.5rem; resize: vertical; font-size: var(--step-0); line-height: 1.6; }
.share__btns { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.4rem; }
.share__apps { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.share-app { border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: 0.3rem 0.85rem; font-size: var(--step--1); cursor: pointer; color: var(--ink); font-weight: 500; }
.share-app:hover { border-color: var(--ink-3); }
.share-app--wa { border-color: #25d366; }
.share-app--fb { border-color: #1877f2; }
.share-app--x { border-color: #111; }
.share-app--tg { border-color: #229ed9; }
@media (max-width: 52rem) { .share__body { grid-template-columns: 1fr; } .share__preview { max-width: 22rem; justify-self: center; } }

/* ---------- Other Oliyon tools ---------- */
.family { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; }
.family__item { display: grid; gap: 0.4rem; align-content: start; padding: 1.1rem 1.2rem; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--paper); text-decoration: none; color: var(--ink); }
.family__item:hover { border-color: var(--ink-3); }
.family__item h3 { font-size: var(--step-1); color: var(--ink); }
.family__item h3::after { content: ' ›'; color: var(--flame-text); }
.family__item p { color: var(--ink-2); font-size: var(--step--1); line-height: 1.65; }

/* ---------- Phones ----------
   Tamil glyphs sit large for their point size, so phones get a tighter scale and less air.
   Form fields stay at 16px or more so iPhones don't zoom in when a field is tapped. */
@media (max-width: 40rem) {
  :root {
    --step--1: 0.78125rem;
    --step-0: 0.90625rem;
    --step-1: 1rem;
    --step-2: 1.1875rem;
    --step-3: 1.375rem;
    --step-4: 2.25rem;
    --gutter: 1rem;
  }
  body { line-height: 1.65; }

  .site-header__row { min-height: 3.6rem; gap: 1rem; }
  .brand img { height: 2.35rem; }
  .menu-btn svg { width: 1.45rem; height: 1.45rem; }
  .nav a { font-size: var(--step-0); padding: 0.6rem 0; }

  .hero { padding: 0.25rem 0 2.25rem; }
  .hero__light { width: min(100%, 22rem); }
  .hero__flame { width: 3.6rem; }
  .hero__tagline { font-size: var(--step-0); }
  .hero__lockup { margin-top: 1.25rem; gap: 0.75rem; }
  .hero__lockup::before, .hero__lockup::after { height: 2px; }
  .hero__ladder { font-size: var(--step-0); margin-top: 0.75rem; }
  .hero__lede { font-size: var(--step-0); margin-top: 0.9rem; line-height: 1.7; }
  .hero__lede .ta { font-size: 1em; }
  .hero__actions { margin-top: 1.5rem; gap: 0.6rem; }
  .btn { min-height: 2.75rem; padding: 0.45rem 1.1rem; font-size: var(--step-0); }

  .section { padding: 2.5rem 0; }
  .section__head { margin-bottom: 1.25rem; }
  .section__head p { font-size: var(--step-0); margin-top: 0.5rem; }
  .feature { padding: 1.1rem 0; gap: 0.35rem; }
  .signs__row dt { font-size: var(--step-1); }

  .olai { padding: 1.9rem 1.25rem 1.25rem; border-radius: 16px; }
  .olai::before, .olai::after { top: 0.7rem; width: 0.7rem; height: 0.7rem; }
  .olai::before { left: 0.8rem; }
  .olai::after { right: 0.8rem; }
  .olai-out { min-height: 6rem; gap: 0.2rem; }
  .olai-out__big { font-size: 1.45rem; }
  .olai-out__line { font-size: var(--step-0); }

  .field { min-height: 3rem; padding: 0.45rem 0.85rem; font-size: 1rem; }
  .field--select { min-height: 2.75rem; font-size: 1rem; }
  .field--text { font-size: 1rem; min-height: 9rem; }
  .field--big, .convert textarea { font-size: 1.25rem; min-height: 5.5rem; }
  .field--big::placeholder, .convert textarea::placeholder { font-size: 0.9375rem; }
  .measure__inputs .field { height: 3rem; }
  .measure__inputs .field--qty { width: 9rem; font-size: 1.125rem; }
  .chip { padding: 0.2rem 0.75rem; }

  .page-head { padding-block: 1.25rem 0.75rem; }
  .page-head p { margin-top: 0.35rem; }
  .subnav { gap: 0.35rem 1rem; padding-bottom: 0.9rem; font-size: var(--step--1); }
  .block { padding: 1.5rem 0 0.5rem; }
  .block h3 { margin-top: 1.25rem; }
  .tabs { margin-bottom: 1.25rem; gap: 0.4rem; }
  .tab { padding: 0.35rem 0.85rem; font-size: var(--step--1); }

  .workbench { gap: 1.25rem; padding-bottom: 2.5rem; }
  .calc { padding: 0.75rem; gap: 0.7rem; }
  .calc__input { font-size: 1.45rem; }
  .keys { gap: 0.4rem; }
  .key { min-height: 2.9rem; font-size: 1.15rem; }
  .key small { font-size: 0.65rem; }
  .key--util { font-size: 0.875rem; }
  .fkey .glyphs { font-size: 1.3rem; }
  .result-row__value { font-size: var(--step-0); }
  .result-row__value.is-big { font-size: var(--step-2); }

  .table .tn { font-size: var(--step-0); }
  .ftable .glyph-chip { min-width: 2.6rem; height: 2.6rem; font-size: 1.5rem; }
  .ftable .name { font-size: var(--step-0); }
  .sign-grid { grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 0.45rem; }
  .sign-card { grid-template-columns: 2.4rem 1fr; padding: 0.4rem 0.5rem; gap: 0.15rem 0.55rem; }
  .sign-card .glyph-chip { height: 2.3rem; font-size: 1.3rem; }
  .sign-card small { font-size: 0.72rem; }

  .answer { font-size: var(--step-0); }
  .quiz__q { font-size: var(--step-1); }
  .quiz__opt { min-height: 2.9rem; font-size: var(--step-0); }
  .cycle__list { columns: 2; padding-left: 1.25rem; font-size: var(--step--1); }
  .cal-form { grid-template-columns: 1fr 1fr; }
  .cal-step { grid-column: 1 / -1; }
  .cal-step .btn { flex: 0 0 3.25rem; min-height: 2.75rem; padding-inline: 0; }
  .cal-step #cal-today { flex: 1 1 auto; }
  .cal-month { margin-top: 1.5rem; }
  .cal-month__head { gap: 0.5rem; }
  .cal-month__head .btn { width: 2.5rem; min-height: 2.5rem; padding: 0; }
  .cal-month__head h3 { font-size: var(--step--1); line-height: 1.45; }
  .cal-grid { gap: 0.25rem; }
  .cal-cell { min-height: 3rem; }
  .cal-cell__greg { font-size: 0.66rem; }
  .pz-verse.olai { padding: 1.6rem 1.1rem 1rem; }
  .pz-verse.olai::before, .pz-verse.olai::after { top: 0.65rem; margin-top: 0; }
  .pz-fields .field { font-size: 1rem; }
  .photo-pick { justify-self: stretch; }

  .site-footer { padding: 2.25rem 0 1.5rem; font-size: var(--step--1); }
  .footer__grid { grid-template-columns: 1fr 1fr; gap: 1.5rem 1rem; }
  .footer__brand { grid-column: 1 / -1; gap: 0.4rem; }
  .footer__brand .flame { width: 1.8rem; }
  .footer__name { font-size: var(--step-1); }
  .footer__col:last-child { grid-column: 1 / -1; }
  .footer__col h2 { margin-bottom: 0.4rem; }
  .footer__col ul { gap: 0.2rem; }
  .footer__bottom { margin-top: 1.75rem; padding-top: 1rem; }
}

/* Phones: tables turn into stacked rows instead of scrolling sideways.
   First two cells share a line; the rest sit underneath in smaller type. */
@media (max-width: 40rem) {
  .table-wrap { overflow-x: visible; margin: 0.5rem 0 1.25rem; }
  .table thead, .ftable thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .table, .table tbody, .ftable, .ftable tbody { display: block; min-width: 0; width: 100%; }
  .table tr, .ftable tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 0.75rem; row-gap: 0.1rem;
    padding: 0.55rem 0.25rem; border-bottom: 1px solid var(--line); align-items: baseline;
  }
  .table td, .ftable td { padding: 0; border: 0; min-width: 0; background: none; }
  .table td:nth-child(2) { text-align: right; }
  .table td:nth-child(n+3) { grid-column: 1 / -1; color: var(--ink-2); font-size: var(--step--1); line-height: 1.5; }
  .table tr.is-current, .measure tr.is-from { background: #fff4e0; }
  .table tr.is-current td, .measure tr.is-from td { background: none; }
  .measure td.is-none { display: none; }
  .measure td.num .sub { display: inline; margin-left: 0.5rem; }
  .measure__error { min-height: 0; margin: 0.35rem 0 0; }

  /* Number names: power on the left; name, number and English stacked beside it. */
  #big-names tr { grid-template-columns: 2.6rem minmax(0, 1fr); }
  #big-names td:nth-child(1) { grid-row: 1 / span 3; }
  #big-names td:nth-child(2) { text-align: left; }
  #big-names td:nth-child(n+3) { grid-column: 2; }
  #big-names td:nth-child(3) { color: var(--ink); font-size: var(--step-0); white-space: normal; overflow-wrap: anywhere; }

  /* Tiny units: name and its divisor on top, the full fraction and decimal below. */
  #tiny-names td:nth-child(1) { grid-column: 1; grid-row: 1; }
  #tiny-names td:nth-child(3) { grid-column: 2; grid-row: 1; font-size: var(--step--1); color: var(--ink-3); }
  #tiny-names td:nth-child(2) { grid-column: 1 / -1; grid-row: 2; text-align: left; color: var(--ink); font-size: var(--step-0); white-space: normal; overflow-wrap: anywhere; }
  #tiny-names td:nth-child(4) { grid-column: 1 / -1; grid-row: 3; }

  /* கீழ்வாய் fractions: sign | name | value, then decimal, share of 320 and code. */
  .ftable tr { grid-template-columns: 2.9rem minmax(0, 1fr) auto auto; align-items: center; }
  .ftable td:nth-child(1) { grid-row: 1 / span 2; }
  .ftable td:nth-child(2) { grid-column: 2 / span 2; grid-row: 1; }
  .ftable td:nth-child(3) { grid-column: 4; grid-row: 1; text-align: right; font-weight: 700; }
  .ftable td:nth-child(n+4) { grid-row: 2; font-size: var(--step--1); color: var(--ink-3); }
  .ftable td:nth-child(4) { grid-column: 2; }
  .ftable td:nth-child(5) { grid-column: 3; }
  .ftable td:nth-child(6) { grid-column: 4; text-align: right; }
  .ftable tr:not(.kiizh) td:nth-child(5)::after { content: ' / 320'; }
  .ftable tr.kiizh { background: #fbf6e8; }
  .ftable .glyph-cell { width: auto; }
}

/* Phones: forms on the Time page and in the measure converter line up in two equal columns,
   with every field the same height so their labels sit on one line. */
@media (max-width: 40rem) {
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; align-items: end; }
  .form-grid > output, .form-grid > .results, .form-grid > fieldset { grid-column: 1 / -1; }
  #year .form-grid > label, #date .form-grid > label { grid-column: 1 / -1; }
  .form-grid .field, .form-grid .field--select { height: 3rem; min-height: 3rem; width: 100%; min-width: 0; margin: 0; }
  .form-grid label { min-width: 0; }
  .measure__inputs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; align-items: end; }
  .measure__inputs label { min-width: 0; }
  .measure__inputs label:nth-child(3) { grid-column: 1 / -1; }
  .measure__inputs .field, .measure__inputs .field--qty { width: 100%; min-width: 0; height: 3rem; }
  .answer { padding-top: 0; }
}

/* Date and time fields: iPhone Safari draws these with its own width, height and centred text,
   which ignores the column they sit in. Take that styling off so they size like every other field. */
input.field[type='date'], input.field[type='time'] {
  -webkit-appearance: none; appearance: none;
  display: block; width: 100%; min-width: 0; max-width: 100%;
  text-align: left; line-height: 1.2; background-color: var(--paper);
}
input.field[type='date']::-webkit-date-and-time-value,
input.field[type='time']::-webkit-date-and-time-value { text-align: left; margin: 0; min-height: 1.2em; }
input.field[type='date']::-webkit-datetime-edit,
input.field[type='time']::-webkit-datetime-edit { padding: 0; }
select.field { -webkit-appearance: none; appearance: none; padding-right: 2.2rem; line-height: 1.2;
  background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2300205b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 0.85rem center / 0.75rem; }
.form-grid > label, .cal-form > label { display: grid; gap: 0.35rem; align-content: end; min-width: 0; }
