/* The editorial setting: light ground, serif headwords, generous measure,
   sources as citations. Deliberately not the desktop app's dark command
   palette — that is a power tool for someone who chose to install it; this is
   a public reference work and should read as one. */

:root {
  --paper: #fbfaf7;
  --ink: #1d1b17;
  --ink-soft: #5c574d;
  --rule: #ddd8cc;
  --accent: #8a5a1e;      /* the headword, and the current word in the rail */
  --citation: #3f6b62;    /* sources — a cool tone, never the accent */
  --highlight: #f2ead9;

  --serif: "Noto Serif Tamil", Georgia, "Times New Roman", serif;
  --sans: "Noto Sans Tamil", system-ui, -apple-system, "Segoe UI", sans-serif;
}

@font-face {
  font-family: "Noto Serif Tamil";
  src: url("/fonts/NotoSerifTamil.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Noto Sans Tamil";
  src: url("/fonts/NotoSansTamil.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
}

/* Masthead ------------------------------------------------------------- */

.masthead {
  display: flex;
  align-items: baseline;
  gap: 2rem;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 0;
  background: var(--paper);
  z-index: 2;
}

.wordmark {
  font-family: var(--serif);
  font-size: 1.35rem;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.search { flex: 1; max-width: 34rem; position: relative; }

#search-input {
  width: 100%;
  padding: 0.55rem 0.85rem;
  font: inherit;
  font-family: var(--sans);
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 3px;
}
#search-input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.composed {
  display: block;
  min-height: 1.4em;
  padding: 0.2rem 0.1rem 0;
  font-family: var(--serif);
  color: var(--ink-soft);
  font-size: 0.95rem;
}

/* The two columns ------------------------------------------------------ */

#app {
  display: grid;
  grid-template-columns: 14rem minmax(0, 42rem);
  gap: 3rem;
  padding: 2.5rem 2rem 4rem;
  max-width: 66rem;
  margin: 0 auto;
}

/* The rail: the margin of a printed page, where the thumb index would be. */
.rail {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-family: var(--serif);
  border-right: 1px solid var(--rule);
  padding-right: 1.5rem;
  align-self: start;
  position: sticky;
  top: 6rem;
}

.rail .edge {
  font-family: var(--sans);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 0.35rem 0;
}

.rail a {
  color: var(--ink-soft);
  text-decoration: none;
  padding: 0.12rem 0.4rem;
  border-radius: 2px;
  overflow-wrap: anywhere;
}
.rail a:hover { color: var(--ink); background: var(--highlight); }

.rail a[aria-current="true"] {
  color: var(--accent);
  background: var(--highlight);
  font-weight: 600;
}

/* The entry ------------------------------------------------------------ */

.entry .headword {
  font-family: var(--serif);
  font-size: 2.6rem;
  line-height: 1.25;
  margin: 0 0 0.35rem;
  color: var(--accent);
  overflow-wrap: anywhere;
}

.entry .rule {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 0 0 1.75rem;
}

.sense { margin: 0 0 1.75rem; }

.sense .meaning {
  margin: 0 0 0.3rem;
  font-family: var(--serif);
  font-size: 1.1rem;
}

/* Sources are citations, set below the sense they belong to and never in the
   accent colour: the accent already means "the word you are looking at". */
.sense .citation {
  margin: 0;
  font-size: 0.85rem;
  color: var(--citation);
  font-variant-numeric: tabular-nums;
}

.message {
  grid-column: 2;
  color: var(--ink-soft);
  font-style: italic;
}

.reverse-btn {
  margin-top: 0.35rem;
  padding: 0.25rem 0.6rem;
  font: inherit;
  font-size: 0.85rem;
  color: var(--citation);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 3px;
  cursor: pointer;
}
.reverse-btn:hover { background: var(--highlight); }
.reverse-btn[hidden] { display: none; }

.results-heading {
  font-family: var(--sans);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 0.75rem;
}

.matches { list-style: none; margin: 0; padding: 0; }
.matches li { border-bottom: 1px solid var(--rule); }
.matches a {
  display: block;
  padding: 0.5rem 0.2rem;
  font-family: var(--serif);
  font-size: 1.15rem;
  color: var(--ink);
  text-decoration: none;
}
.matches a:hover { background: var(--highlight); }

.colophon {
  border-top: 1px solid var(--rule);
  padding: 1.5rem 2rem 3rem;
  color: var(--ink-soft);
  font-size: 0.85rem;
  text-align: center;
}

/* Narrow viewports: the rail becomes a filmstrip above the entry, which is
   what dict_demo settled on for a phone. */
@media (max-width: 820px) {
  .masthead { flex-direction: column; align-items: stretch; gap: 0.75rem; }
  #app {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
    padding: 1.5rem 1.25rem 3rem;
  }
  .rail {
    flex-direction: row;
    overflow-x: auto;
    gap: 0.75rem;
    border-right: 0;
    border-bottom: 1px solid var(--rule);
    padding: 0 0 0.75rem;
    position: static;
    scrollbar-width: none;
  }
  .rail .edge { display: none; }
  .rail a { white-space: nowrap; }
  .message { grid-column: 1; }
  .entry .headword { font-size: 2rem; }
}

@media (prefers-reduced-motion: no-preference) {
  .rail { scroll-behavior: smooth; }
}
