/* time.cocode.dk: the house style of the cocode.dk sites, shaped for a library of notes.
   Mobile first; wider layouts are added with min-width queries. Logical properties make the
   Persian (right-to-left) pages mirror without extra rules. */

@font-face { font-family: "Vazirmatn"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/fonts/vazirmatn-arabic-wght-normal.woff2) format("woff2"); unicode-range: U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0897-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC,U+102E0-102FB,U+10E60-10E7E,U+10EC2-10EC4,U+10EFC-10EFF,U+1EE00-1EE03,U+1EE05-1EE1F,U+1EE21-1EE22,U+1EE24,U+1EE27,U+1EE29-1EE32,U+1EE34-1EE37,U+1EE39,U+1EE3B,U+1EE42,U+1EE47,U+1EE49,U+1EE4B,U+1EE4D-1EE4F,U+1EE51-1EE52,U+1EE54,U+1EE57,U+1EE59,U+1EE5B,U+1EE5D,U+1EE5F,U+1EE61-1EE62,U+1EE64,U+1EE67-1EE6A,U+1EE6C-1EE72,U+1EE74-1EE77,U+1EE79-1EE7C,U+1EE7E,U+1EE80-1EE89,U+1EE8B-1EE9B,U+1EEA1-1EEA3,U+1EEA5-1EEA9,U+1EEAB-1EEBB,U+1EEF0-1EEF1; }
@font-face { font-family: "Vazirmatn"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/fonts/vazirmatn-latin-wght-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; }

:root {
  --paper: #f6efe0;
  --sheet: #fbf7ee;
  --ink: #1d2130;
  --muted: #4a4639;
  --rule: #c8bca4;
  --accent: #1d4f7a;
  --brass: #9a6412;
  --tint: rgb(29 79 122 / 6%);
  --serif: "Ibarra Real Nova", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Ysabeau Office", "Gill Sans", "Trebuchet MS", sans-serif;
  --text: var(--serif);
  --ui: var(--sans);
  --gutter: 20px;
  --max: 1180px;
  --measure: 40rem;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #15181f; --sheet: #1c2029; --ink: #ebe5d6; --muted: #b9b09b; --rule: #3b4150;
    --accent: #9cc3ea; --brass: #e0a94a; --tint: rgb(156 195 234 / 8%);
  }
}
[dir="rtl"] { --text: "Vazirmatn", Tahoma, sans-serif; --ui: "Vazirmatn", Tahoma, sans-serif; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1.125rem/1.65 var(--text); }
[dir="rtl"] body { font-size: 1.0625rem; line-height: 1.95; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.skip { position: absolute; inset-inline-start: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 12px; z-index: 10; }
.skip:focus { inset-inline-start: 8px; }
h1, h2, h3 { font-family: var(--ui); font-weight: 600; line-height: 1.2; text-wrap: balance; }
h1 { font-size: 2.1rem; margin: 0 0 0.5rem; letter-spacing: -0.01em; }
h2 { font-size: 1.45rem; margin: 2.4rem 0 0.8rem; }
h3 { font-size: 1.15rem; margin: 1.8rem 0 0.5rem; }
p, ul, ol { margin: 0 0 1rem; }
li { margin-block: 0.3rem; }
strong { font-weight: 700; }
main.wrap { max-width: var(--max); margin-inline: auto; padding: 8px var(--gutter) 64px; }
main:focus { outline: none; }
.lead { font-size: 1.2rem; color: var(--muted); max-width: var(--measure); }

/* Breadcrumb, facets, contents */
.crumbs { font: 500 0.95rem/1.4 var(--ui); color: var(--muted); margin: 12px 0 28px; }
.crumbs a { color: inherit; }
.note-head { border-block-end: 1px solid var(--rule); padding-block-end: 1.2rem; margin-block-end: 1.5rem; }
.facets { display: grid; gap: 4px; margin: 1rem 0 0; font: 0.95rem/1.5 var(--ui); }
.facets div { display: flex; gap: 0.6em; }
.facets dt { font-weight: 600; flex: none; }
.facets dd { margin: 0; color: var(--muted); }
.toc { background: var(--sheet); border: 1px solid var(--rule); border-radius: 6px; padding: 14px 18px; margin-block-end: 2rem; font: 1rem/1.45 var(--ui); }
.toc-title { font-weight: 600; margin: 0 0 6px; }
.toc ol { margin: 0; padding-inline-start: 1.3em; }
[dir="rtl"] ol { list-style-type: persian; }
.toc a { color: var(--ink); text-decoration: none; }
.toc a:hover { color: var(--accent); text-decoration: underline; }

/* Note body */
.note-figure { margin: 0 0 2rem; }
section > .note-figure { margin: 0.5rem 0 1.75rem; }
.note-figure img { display: block; width: auto; height: auto; max-width: 100%; max-height: min(60vh, 420px);
  border-radius: 6px; background: var(--sheet); }
.note-figure figcaption { font: 0.95rem/1.5 var(--ui); color: var(--muted); margin-top: 8px; }
.note-figure .credit { display: block; font-size: 0.85rem; margin-top: 2px; }
.note-figure .credit a { color: inherit; }
.note-body { max-width: var(--measure); }
.note-body > section:first-child h2, .note-body > p:first-child + section h2 { margin-top: 0.5rem; }
.debates { background: var(--tint); border-inline-start: 3px solid var(--accent); padding: 2px 20px 6px; margin-block: 2.4rem; border-radius: 0 6px 6px 0; }
[dir="rtl"] .debates { border-radius: 6px 0 0 6px; }
.debates h2 { margin-top: 1.2rem; }
.sources { font: 0.95rem/1.55 var(--ui); color: var(--muted); }
.sources h2 { color: var(--ink); }
.sources a { overflow-wrap: anywhere; }
em.unverified { font: italic 0.85em var(--ui); color: var(--muted); text-decoration: underline dotted; text-underline-offset: 0.2em; cursor: help; white-space: nowrap; }
.table-wrap { overflow-x: auto; margin: 0 0 1.4rem; border: 1px solid var(--rule); border-radius: 6px; background: var(--sheet); }
table { border-collapse: collapse; font: 0.95rem/1.45 var(--ui); min-width: 100%; }
th, td { text-align: start; vertical-align: top; padding: 8px 12px; border-block-end: 1px solid var(--rule); }
thead th { position: sticky; top: 0; background: var(--sheet); }
.edit { font: 0.95rem var(--ui); margin-top: 2rem; }
.pager { display: grid; gap: 12px; margin-top: 2.5rem; border-block-start: 1px solid var(--rule); padding-block-start: 1.2rem; font-family: var(--ui); max-width: var(--measure); }
.pager a { display: block; text-decoration: none; padding: 6px 0; }
.pager span { display: block; font-size: 0.9rem; color: var(--muted); }
.pager a[rel="next"] { text-align: end; }

/* Home */
.home-head { display: grid; gap: 28px; margin: 20px 0 8px; }
.home-head h1 { font: 500 2.4rem/1.08 var(--serif); letter-spacing: -0.015em; max-width: 16ch; }
[dir="rtl"] .home-head h1 { font: 700 2.1rem/1.4 var(--ui); max-width: 20ch; }
.today { background: var(--sheet); border: 1px solid var(--rule); border-radius: 6px; padding: 16px 18px 10px; align-self: start; }
.today h2 { font-size: 1.05rem; margin: 0 0 8px; }
.today table { font: 1rem/1.35 var(--ui); }
.today th, .today td { border: 0; padding: 7px 0; }
.today th { font-weight: 500; width: 40%; }
.today th a { color: var(--ink); text-decoration-color: var(--rule); }
.today td { display: flex; align-items: baseline; gap: 8px; font-family: var(--text); font-size: 1.08rem; text-align: end; padding-inline-start: 8px; }
.today td::before { content: ""; flex: 1 1 12px; min-width: 12px; border-block-end: 2px dotted var(--rule); }
.ways ul, .notes { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px 32px; }
.notes li { margin: 0; padding: 12px 0; border-block-start: 1px solid var(--rule); }
.notes li > a { font: 600 1.12rem/1.3 var(--ui); text-decoration: none; color: var(--ink); }
.notes li > a:hover { color: var(--accent); text-decoration: underline; }
.notes p { margin: 4px 0 0; font-size: 1rem; line-height: 1.5; color: var(--muted); }
.ways li > a { color: var(--accent); }
.find { display: block; margin: 2.6rem 0 0.5rem; max-width: 32rem; }
.find label { display: block; font: 600 1.05rem var(--ui); margin-bottom: 6px; }
.find input { width: 100%; font: 1.1rem var(--ui); padding: 11px 14px; min-height: 44px; color: var(--ink); background: var(--sheet); border: 1px solid var(--rule); border-radius: 6px; }
.find input::placeholder { color: var(--muted); opacity: 0.8; }
.count { font: 0.95rem var(--ui); color: var(--muted); min-height: 1.4em; margin: 6px 0 0; }
.group h2 { border-block-end: 2px solid var(--ink); padding-block-end: 6px; }
.group .notes li:first-child { border-block-start: 0; }
.method { max-width: var(--measure); margin-top: 3rem; border-block-start: 1px solid var(--rule); }
.method p { font-size: 1rem; color: var(--muted); }

@media (min-width: 640px) {
  :root { --gutter: 32px; }
  .today th { white-space: nowrap; width: 1%; }
  h1 { font-size: 2.6rem; }
  .home-head h1 { font-size: 3.2rem; }
  [dir="rtl"] .home-head h1 { font-size: 2.6rem; }
  .ways ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pager { grid-template-columns: 1fr 1fr; }
  .pager a[rel="next"]:only-child { grid-column: 2; }
}
@media (min-width: 768px) {
  .group .notes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .group .notes li:nth-child(2) { border-block-start: 0; }
}
@media (min-width: 1024px) {
  .home-head { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 56px; margin-top: 40px; }
  .home-head h1 { font-size: 3.6rem; }
  .ways ul { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ways li { border-block-start: 2px solid var(--accent); }
  .note { display: grid; grid-template-columns: minmax(0, var(--measure)) 17rem; column-gap: 56px; }
  .note-head, .pager { grid-column: 1 / -1; }
  .note-head { max-width: none; }
  .toc { grid-column: 2; grid-row: 2; position: sticky; top: 16px; align-self: start; max-height: calc(100vh - 32px); overflow: auto; }
  .note-body { grid-column: 1; grid-row: 2; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
