/* History of Italy — site theme, loaded after core/css/style.css and the
   rulers-groups module CSS. Only rules where the original Italy
   stylesheet differs from core in a way that shows on its pages (it is
   the Turkey stylesheet with wider modals, which core already exceeds).
   Where core sets a property inside a @media block and a base rule here
   overrides it, the media rule is restated below so the original
   breakpoints still apply. */

/* ════════════════════════════════════════
   1. Design tokens — fonts (same set as Turkey and the Netherlands)
════════════════════════════════════════ */
:root {
  --f-heading: 'Inria Serif', Georgia, serif;
  --f-body: 'Source Sans 3', 'Crimson Text', Georgia, serif;
  --f-ui: 'Source Sans 3', system-ui, sans-serif;
}

/* ════════════════════════════════════════
   2. Intro overlay — keeps the picture open at the edges and shades the
      timeline column and the text area
════════════════════════════════════════ */
#bg-overlay-intro {
  background:
    linear-gradient(to right,
      rgba(3,2,7,0.85) 0%,
      rgba(3,2,7,0.7) calc(var(--tl-x) + 40px),
      rgba(3,2,7,0.35) var(--panel-w),
      rgba(3,2,7,0) calc(var(--panel-w) + 200px)
    ),
    radial-gradient(ellipse 60% 55% at 60% 47%,
      rgba(3,2,7,0.8) 0%,
      rgba(3,2,7,0.62) 45%,
      rgba(3,2,7,0.3) 75%,
      rgba(3,2,7,0) 100%
    ),
    linear-gradient(to top,
      rgba(3,2,7,0.32) 0%,
      rgba(3,2,7,0) 26%
    ),
    linear-gradient(to bottom,
      rgba(3,2,7,0.08) 0%,
      rgba(3,2,7,0.14) 100%
    );
}

/* ════════════════════════════════════════
   3. Logo — the Italy wordmark is wider than core's default
════════════════════════════════════════ */
#app-logo { width:180px; }
@media (max-width:1200px) { #app-logo { width:142.5px; } }
@media (max-width:960px)  { #app-logo { width:170px; } }
@media (max-width:760px)  { #app-logo { width:150px; } }
@media (max-width:520px)  { #app-logo { width:130px; } }

/* ════════════════════════════════════════
   4. Rulers page — dynasty tabs in the heading face, closer legend
════════════════════════════════════════ */
.rp-tabs-group { gap:8px; }
.rp-tab {
  gap:10px; white-space:nowrap;
  padding:12px 18px;
  font-family:var(--f-heading); font-size:13.6px; font-weight:400; letter-spacing:0;
  border-color:rgba(255,255,255,0.16);
}
.rp-tab:hover { border-color:rgba(255,255,255,0.35); }
@media (max-width:600px) {
  .rp-tab { padding:9px 13px; font-size:12px; }   /* module rule, restated */
}
.rp-legend { margin-bottom:32px; }

/* Rulers search: 30% wider than the core 280px, with a lighter border,
   icon and placeholder so it reads clearly against the dark panel
   (same as Turkey and Great Britain). */
.rp-search-wrap { border-color:rgba(255,255,255,0.3); color:var(--white); }
.rp-search-wrap:focus-within { border-color:rgba(201,168,68,0.7); }
.rp-search-icon { opacity:0.9; }
.rp-search-input::placeholder { color:var(--white-mid); }
@media (min-width:901px) { .rp-search-wrap { width:364px; } }
.rp-dynasty-info { margin:0 0 30px; }

/* ════════════════════════════════════════
   MAP — "Italy Through Time" (js/italy-map.js, 2026-11-18), as in the
   prototype data/italy-map.html and San Marino's map: a dark background,
   the land behind the shapes, the 70 areas coloured by ruling power, the
   modern border (shown from 1954) and the area names, which show once the
   map is zoomed in.
════════════════════════════════════════ */
.cm-sphere { fill:#0b1420; }
.cm-grat { fill:none; stroke:rgba(201,168,68,0.22); stroke-width:1.1; stroke-dasharray:1 3; vector-effect:non-scaling-stroke; }
.cm-bgland { fill:#16141d; stroke:rgba(201,168,68,0.18); stroke-width:0.6; vector-effect:non-scaling-stroke; pointer-events:none; }
.cm-country { fill:#24212c; stroke:#0a0810; stroke-width:0.6; vector-effect:non-scaling-stroke; }
.cm-coast { fill:none; stroke:rgba(201,168,68,0.45); stroke-width:1; vector-effect:non-scaling-stroke; pointer-events:none; }
.cm-border {
  fill:none; stroke:#f4ecd6; stroke-width:2; vector-effect:non-scaling-stroke;
  pointer-events:none; opacity:0; transition:opacity 0.8s ease;
}
.cm-border.on { opacity:0.9; }
.cm-county-label {
  font-family:var(--f-ui); fill:rgba(255,255,255,0.55); text-anchor:middle; pointer-events:none;
  paint-order:stroke; stroke:rgba(5,3,8,0.6); transition:opacity 0.4s ease;
}
/* Ruling powers: only those on the map in the year shown are listed. */
.cm-lg--trad span { cursor:default; }
#cm-lg-trad span.off { display:none; }

/* Italy is tall: a taller stage than core's 16:5.95 (as in the prototype),
   so the peninsula is not shrunk beside the legend and chapter panel. On
   phones (core's max-width:900px rules) the map keeps the data's shape. */
@media (min-width:901px) {
  .cm-stage { height:calc(100cqw * 8.2 / 16 + 50px); min-height:640px; max-height:max(640px, 88vh); }
}
@media (max-width:900px) {
  .cm-stage #cm-svg { aspect-ratio:1000 / 1056; }
}

/* Thirteen era buttons: one row on wide screens, two below 1400px. */
.cm-eras { grid-template-columns:repeat(13, minmax(0, 1fr)); }
.cm-eras button { padding-left:4px; padding-right:4px; }
.cm-eras button small { font-size:11.5px; }
@media (max-width:1400px) { .cm-eras { grid-template-columns:repeat(7, minmax(0, 1fr)); } }
/* 68 chapters: italy-map.js marks the year labels that would collide
   (the current one always shows). */
.cm-tick-labels button.thin:not(.cur) { visibility:hidden; }
.cm-tick-labels button:first-child { transform:none; }
.cm-tick-labels button:last-child { transform:translateX(-100%); }
@media (max-width:900px) {
  .cm-eras { grid-template-columns:repeat(3, minmax(0, 1fr)); }
}

/* Key Events: dates like "c. 3300 BCE" need a wider year column than
   core's (the rail moves with it: column + 20px gap + half the dot); rows
   without a timeline entry open their Wikipedia article. */
.cm-events .ag-event { grid-template-columns:78px 9px minmax(0, 1fr); }
.cm-events .ag-event::before { left:102px; }
.cm-events .ag-event-year { overflow-wrap:break-word; }
.cm-events .ag-event--linked { cursor:pointer; }
.cm-event-ext {
  display:inline-block; width:13px; height:13px; margin-left:7px; vertical-align:-1px;
  fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; opacity:0.55;
}
.cm-event--wiki:hover .cm-event-ext, .cm-event--wiki:focus-visible .cm-event-ext { opacity:1; }
