/*
 * Colours come from the shrine: sindoor paste, hibiscus, marigold, and the pale
 * pink of the original site. Modak, the display face, is named after Ganesha's
 * sweet; Tiro Devanagari Sanskrit was drawn for setting Sanskrit literature.
 * Modak closes up when small, so it is only used for page titles and the names.
 * Photos are small originals, so none is shown larger than its real size.
 *
 * 1. Fonts and tokens   2. Base    3. Header and footer
 * 4. Home               5. Topics  6. Names
 */

/* 1. Fonts and tokens ---------------------------------------------------- */

@font-face {
    font-family: "Modak";
    src: url("../fonts/modak-latin.woff2") format("woff2");
    font-display: swap;
}
@font-face {
    font-family: "Modak";
    src: url("../fonts/modak-devanagari.woff2") format("woff2");
    font-display: swap;
    unicode-range: U+0900-097F, U+200C-200D;
}
@font-face {
    font-family: "Mukta";
    src: url("../fonts/mukta-latin-500.woff2") format("woff2");
    font-weight: 500;
    font-display: swap;
}
@font-face {
    font-family: "Mukta";
    src: url("../fonts/mukta-latin-700.woff2") format("woff2");
    font-weight: 700;
    font-display: swap;
}
@font-face {
    font-family: "Mukta";
    src: url("../fonts/mukta-latin-ext-700.woff2") format("woff2");
    font-weight: 700;
    font-display: swap;
    unicode-range: U+0100-024F, U+1E00-1EFF;
}
@font-face {
    font-family: "Tiro";
    src: url("../fonts/tiro-latin.woff2") format("woff2");
    font-display: swap;
}
@font-face {
    font-family: "Tiro";
    src: url("../fonts/tiro-latin-ext.woff2") format("woff2");
    font-display: swap;
    unicode-range: U+0100-024F, U+1E00-1EFF;
}
@font-face {
    font-family: "Tiro";
    src: url("../fonts/tiro-latin-italic.woff2") format("woff2");
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: "Tiro";
    src: url("../fonts/tiro-latin-ext-italic.woff2") format("woff2");
    font-style: italic;
    font-display: swap;
    unicode-range: U+0100-024F, U+1E00-1EFF;
}

:root {
    --sindoor: #e8480c;
    --hibiscus: #a3113f;
    --marigold: #ffb81f;
    --plum: #3d0a24;
    --petal: #ffeeee;
    --white: #fff;

    --display: "Modak", "Arial Black", "Nirmala UI", sans-serif;
    --ui: "Mukta", "Nirmala UI", system-ui, sans-serif;
    --body: "Tiro", Georgia, "Nirmala UI", "Noto Serif Devanagari", serif;

    --text-s: 1rem;
    --text-m: 1.1875rem;
    --text-l: 1.375rem;
    --text-xl: clamp(1.75rem, 1.5rem + 1vw, 2.25rem);
    --text-xxl: clamp(3rem, 1.75rem + 4.5vw, 5rem);
    --text-hero: min(12vw, 10.25rem);

    --gap: clamp(1.5rem, 1rem + 2vw, 3rem);
    --section: clamp(3rem, 2.25rem + 3vw, 5rem);
}

/* 2. Base ---------------------------------------------------------------- */

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

body {
    margin: 0;
    background: var(--white);
    color: var(--plum);
    font: 400 var(--text-m)/1.65 var(--body);
    -webkit-text-size-adjust: 100%;
}

h1, h2, h3, p, ul, ol, dl, dd, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img { display: block; max-width: 100%; height: auto; }

h1 { font: 400 var(--text-xxl)/1 var(--display); text-wrap: balance; }
h2, h3 { font-family: var(--ui); font-weight: 700; line-height: 1.2; text-wrap: balance; }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-l); }
/* Tiro has no bold, so names in bold use the heading face. */
strong { font: 700 0.97em/1 var(--ui); }

a { color: var(--hibiscus); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 3px; }
:focus-visible { outline: 3px solid var(--plum); outline-offset: 3px; }
main:focus { outline: none; }
[id] { scroll-margin-top: 1.5rem; }

.wrap {
    width: 100%;
    max-width: 74rem;
    margin-inline: auto;
    padding-inline: clamp(1.125rem, 4vw, 2.5rem);
}

.skip-link {
    position: absolute;
    left: 1rem;
    top: -5rem;
    z-index: 1;
    padding: 0.5rem 1rem;
    background: var(--white);
}
.skip-link:focus { top: 1rem; }

/* 3. Header and footer --------------------------------------------------- */

.site-header { background: var(--plum); color: var(--white); font: 500 var(--text-s)/1.4 var(--ui); }
.site-header__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.25rem 2rem;
    padding-block: 0.75rem;
}
.site-header a { color: inherit; text-decoration: none; }
.site-header :focus-visible,
.site-footer :focus-visible,
.names :focus-visible { outline-color: var(--marigold); }

.brand { display: flex; align-items: center; gap: 0.5rem; font: 700 1.5rem/1.4 var(--ui); }

.site-nav { display: flex; flex-wrap: wrap; gap: 0 1.375rem; }
.site-nav a { display: block; padding-block: 0.5rem; border-bottom: 3px solid transparent; }
.site-nav a:hover { border-color: var(--white); }
.site-nav a[aria-current] { border-color: var(--marigold); }

.read-next { background: var(--marigold); }
.read-next a { display: block; padding-block: 2rem; color: var(--plum); text-decoration: none; }
.read-next span { display: block; font: 500 var(--text-s)/1.4 var(--ui); }
.read-next strong { font: 700 var(--text-xl)/1.2 var(--ui); }
.read-next a:hover strong { text-decoration: underline; text-decoration-thickness: 3px; }

.site-footer { background: var(--plum); color: var(--white); font: 500 var(--text-s)/1.5 var(--ui); }
.site-footer__row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem 2rem;
    padding-block: 2rem;
}
.site-footer a, .names a { color: var(--marigold); }

/* 4. Home ---------------------------------------------------------------- */

.hero { background: var(--sindoor); }
.hero__row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 22rem);
    align-items: end;
    gap: var(--gap);
    padding-top: var(--section);
}
.hero__text { padding-bottom: var(--section); }
.hero h1 { margin-left: -0.03em; color: var(--white); font-size: var(--text-hero); line-height: 0.95; }
.hero__line { margin-block: 0.75rem 1rem; font: 700 var(--text-xl)/1.2 var(--ui); text-wrap: balance; }
.hero__line + p { max-width: 34rem; }

/* The murti sits in a shrine arch that steps out of the hero. */
.hero__photo { margin-bottom: -3.5rem; }
.hero__photo img { width: 100%; border: 8px solid var(--marigold); border-radius: 50vw 50vw 0 0; }
.hero__photo figcaption { padding-top: 0.5rem; font: 500 var(--text-s)/1.4 var(--ui); min-height: 3rem; }

.index { margin-top: var(--section); padding-block: var(--section); background: var(--petal); }
.index__list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr));
    gap: var(--gap);
    margin-top: var(--gap);
}
.index__list li { position: relative; display: flex; align-items: center; gap: 1.25rem; }
.index__list img {
    flex: none;
    width: 7rem;
    height: 8.5rem;
    object-fit: cover;
    border-radius: 3.5rem 3.5rem 0 0;
}
.index__list h3 { font-size: 1.5rem; }
.index__list h3 a { text-decoration: none; }
.index__list h3 a::after { content: ""; position: absolute; inset: 0; }
.index__list li:hover h3 a { text-decoration: underline; text-decoration-thickness: 3px; }
.index__list p { margin-top: 0.375rem; font-size: 1.0625rem; line-height: 1.45; }

/* 5. Topics -------------------------------------------------------------- */

.page-head { padding-block: 1.25rem var(--gap); background: var(--sindoor); }
.page-head h1 { margin-block: 1.25rem 0.75rem; color: var(--white); }
.page-head a { color: var(--plum); }
.page-head__summary { max-width: 38rem; font: 700 var(--text-l)/1.35 var(--ui); }

.breadcrumb ol { display: flex; flex-wrap: wrap; font: 500 var(--text-s)/1.4 var(--ui); }
.breadcrumb li + li::before { content: "/"; margin-inline: 0.5rem; }

.jump { display: flex; flex-wrap: wrap; gap: 0.625rem; margin-top: 1.5rem; }
.jump a {
    display: block;
    padding: 0.375rem 0.875rem;
    background: var(--petal);
    font: 500 var(--text-s)/1.5 var(--ui);
    text-decoration: none;
}
.jump a:hover { background: var(--marigold); }

.topic {
    display: grid;
    grid-template-columns: minmax(0, 40rem) minmax(0, 24rem);
    justify-content: space-between;
    align-items: start;
    gap: var(--gap);
    padding-block: var(--section) 0;
}
.topic:last-of-type { padding-bottom: var(--section); }

.prose > * + * { margin-top: 1.1em; }
.prose > h3 { margin-top: 1.5em; }
.prose > h2 + *, .prose > h3 + * { margin-top: 0.5em; }
.prose ul { padding-left: 1.25em; list-style: disc; }
.prose li + li { margin-top: 0.5em; }
.prose li::marker { color: var(--sindoor); }

blockquote { padding: 1.25rem 1.5rem; background: var(--petal); }
.verse { line-height: 1.9; }

.photo figcaption { margin-top: 0.625rem; font: 500 var(--text-s)/1.4 var(--ui); }
/* As a table, the figure stays as narrow as its photo, however long the caption. */
.photo { display: table; }
.photo figcaption { display: table-caption; caption-side: bottom; }

/* 6. Names --------------------------------------------------------------- */

.names { margin-top: var(--section); padding-block: var(--section); background: var(--plum); color: var(--white); }
.names__list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
    gap: 2.5rem var(--gap);
    margin-block: var(--gap);
}
.names dt { font: 700 var(--text-l)/1.3 var(--ui); }
.names dt span {
    display: block;
    color: var(--marigold);
    font: 400 clamp(3.25rem, 2.5rem + 2vw, 4.25rem)/1.35 var(--display);
}
.names dt [lang="ta"] { font-family: "Nirmala UI", "Noto Sans Tamil", sans-serif; font-weight: 700; font-size: 2.25rem; line-height: 2.1; }

@media (max-width: 55rem) {
    :root { --text-hero: 20vw; }
    .hero__row, .topic { grid-template-columns: minmax(0, 1fr); }
    .hero__text { padding-bottom: 0; }
    .hero__photo { width: min(100%, 22rem); margin: 0 auto; padding-bottom: 1rem; }
}

@media print {
    .site-header nav, .page-head nav, .read-next { display: none; }
}
