/* Shared shell for Clock, Timer and Stopwatch. Page-specific layout stays in
   clock-layout.css / clock-styles.css or the tool rules in styles.css. */

/* One shared palette for all three tools, based on the standard clock theme.
   Clock rendering colors and the explicit clock color choices stay in
   clock-styles.css and only repaint the clock page. */
:root {
  color-scheme: dark;
  --bg: #191c22;
  --surface: #23272f;
  --text: #f2f4f8;
  --muted: #b0b7c4;
  --line: #3c4350;
  --accent: #a9beff;
  --accent-text: #172449;
  --focus: #a9beff;
}
:root[data-theme=light] {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #171b24;
  --muted: #626a78;
  --line: #dce1e9;
  --accent: #315fe8;
  --accent-text: #ffffff;
  --focus: #315fe8;
}

@font-face {
  font-family: Manrope;
  src: url('/assets/fonts/manrope-variable.ttf') format('truetype');
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
}

body { font-family: Manrope, 'Segoe UI', sans-serif; -webkit-font-smoothing: antialiased; }
button, select, input, textarea { font-family: inherit; }
button, select { touch-action: manipulation; }

.site-header { max-width: 1280px; margin: auto; min-height: 84px; padding: 24px 40px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 18px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 700; letter-spacing: -.6px; text-decoration: none; }
.brand svg { width: 25px; height: 25px; fill: none; stroke: var(--text); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.tool-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.site-header .tool-nav { margin-left: auto; }
.header-actions { display: flex; align-items: center; gap: 6px; }
.theme-quick, .lang-toggle { display: inline-flex; align-items: center; gap: 7px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); font-size: 11px; font-weight: 600; }
.theme-quick:hover, .lang-toggle:hover { border-color: var(--muted); }
.theme-quick .theme-icon { width: 15px; height: 15px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.theme-quick[aria-pressed=false] .theme-icon-sun { display: none; }
.theme-quick[aria-pressed=true] .theme-icon-moon { display: none; }
.theme-quick span, .lang-toggle span { white-space: nowrap; }
.flag, .lang-toggle .flag, .lang-menu .flag { width: 20px; height: 14px; flex: 0 0 auto; }
.flag svg { display: block; width: 100%; height: 100%; border-radius: 2px; }

/* One click-to-open language popover at every viewport size. */
.lang-menu { position: fixed; z-index: 40; width: min(236px, calc(100vw - 16px)); display: flex; flex-direction: column; gap: 3px; padding: 8px; overflow-y: auto; overscroll-behavior: contain; scroll-padding-block: 52px 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 40px #00000030; }
.lang-menu a { display: flex; flex: 0 0 auto; align-items: center; gap: 10px; min-height: 42px; padding: 10px 12px; border-radius: 9px; color: var(--muted); font-size: 12px; text-decoration: none; }
.lang-menu a:hover { color: var(--text); background: var(--bg); }
.lang-menu a[aria-current=page] { color: var(--text); background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); }
.lang-menu a:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.lang-menu-head { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 12px; padding: 0 4px 7px; border-bottom: 1px solid var(--line); margin-bottom: 4px; position: sticky; top: -8px; z-index: 2; background: var(--surface); }
.lang-menu-title { font-size: 12px; font-weight: 600; color: var(--muted); }
.lang-menu-close { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); color: var(--text); }
.lang-menu-close svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.lang-toggle { min-height: 38px; }
.lang-toggle::after { content: ''; width: 6px; height: 6px; margin-left: 3px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg); }
.lang-toggle[aria-expanded=true]::after { transform: translateY(1px) rotate(225deg); }
/* In fullscreen the language entry follows the clock chrome: it rests while the
   controls are hidden and returns as soon as the user reveals them. */
html:fullscreen .site-header { display: flex; position: fixed; top: env(safe-area-inset-top, 0px); right: env(safe-area-inset-right, 0px); z-index: 30; min-height: 0; padding: 10px 12px; pointer-events: none; }
html:fullscreen .site-header .brand, html:fullscreen .site-header .tool-nav { display: none; }
html:fullscreen .site-header .header-actions { pointer-events: auto; }
html:fullscreen[data-controls-hidden="true"] .site-header,
html:fullscreen[data-controls-hidden="true"] .lang-menu,
html:fullscreen[data-controls-hidden="true"] .lang-toggle { display: none !important; }
.tool-nav a { padding: 9px 15px; border: 1px solid transparent; border-radius: 9px; font-size: 12px; color: var(--muted); text-decoration: none; }
.tool-nav a:hover { color: var(--text); border-color: var(--line); }
.tool-nav a[aria-current=page] { background: var(--surface); border-color: var(--line); color: var(--text); }
.lang-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 11px; }
.lang-nav a { padding: 4px 2px; border-bottom: 1px solid transparent; color: var(--muted); text-decoration: none; }
.lang-nav a:hover { color: var(--text); }
.lang-nav a[aria-current=page] { border-bottom-color: var(--line); color: var(--text); }

.clock-section h1, .tool-section h1 { margin: 0 0 28px; font-size: 16px; font-weight: 500; letter-spacing: -.3px; color: var(--muted); text-wrap: balance; }
.tool-section h1 { margin-bottom: 20px; }

.about-section, .faq-section, footer { max-width: 1000px; margin: auto; border-top: 1px solid var(--line); }
.about-section { display: grid; grid-template-columns: 1fr 1fr; gap: 100px; padding: 55px 0; }
.faq-section { display: grid; grid-template-columns: 1fr 1fr; gap: 100px; padding: 48px 0 58px; }
.about-section h2, .faq-section h2 { margin-top: 0; font-size: 28px; font-weight: 500; letter-spacing: -.9px; line-height: 1.3; text-wrap: balance; }
.faq-section h2 { font-size: 23px; }
.intro-copy > p, .instructions p, .faq-list p { font-size: 12px; line-height: 1.9; }
.instructions h3 { font-size: 12px; font-weight: 700; }
summary { font-size: 12px; padding-block: 18px; }
footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 22px; padding: 26px 0 32px; font-size: 10px; color: var(--muted); }

/* Tool surfaces follow the clock's type, button and panel language without
   converting timer inputs or the lap table into a clock face. */
.tool-section { max-width: 1000px; margin: auto; padding: 58px 32px 64px; min-height: 650px; text-align: center; }
.tool-display { font-family: Manrope, 'Segoe UI', sans-serif; font-weight: 400; letter-spacing: -.065em; font-variant-numeric: tabular-nums; }
.tool-button { border-radius: 10px; padding: 12px 18px; min-height: 47px; font-size: 12px; font-weight: 600; }
.tool-button:hover { border-color: var(--muted); filter: none; }
.tool-button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.tool-actions .primary, .actions .primary { min-width: 120px; }
.tool-state { font-size: 12px; }
.session-note, .tool-note { font-size: 11px; }
.feedback { font-size: 11px; }
.field input { border-radius: 10px; font-family: Manrope, 'Segoe UI', sans-serif; font-weight: 500; }
.field label, .field-hint, .field-error, .error { font-size: 11px; }
.presets button { border-radius: 10px; font-size: 11px; }
.lap-panel, .laps-panel { border: 1px solid var(--line); border-radius: 14px; padding: 18px; background: var(--surface); }
.lap-header h2 { font-size: 16px; }
.lap-table-wrap, .lap-scroll { border-radius: 10px; background: var(--bg); }
.confirm-panel { border-radius: 14px; background: var(--surface); }
.confirm-panel h2 { font-size: 18px; }
.confirm-panel p { font-size: 12px; line-height: 1.8; }

@media (max-width: 1100px) {
  .about-section, .faq-section, footer { margin-inline: 40px; }
}
@media (max-width: 650px) {
  .site-header { min-height: 76px; padding: 20px 18px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px 10px; }
  .brand { font-size: 15px; }
  .site-header .header-actions { grid-column: 2; grid-row: 1; }
  .site-header .tool-nav { grid-column: 1/-1; grid-row: 2; margin-left: 0; }
  .theme-quick { min-height: 38px; padding: 8px; }
  .theme-quick span { display: none; }
  .lang-toggle { padding: 8px 9px; font-size: 10px; gap: 5px; }
  .tool-nav a { padding: 7px 11px; font-size: 11px; }
  .tool-section { min-height: 600px; padding: 40px 18px 44px; }
  .about-section, .faq-section, footer { margin-inline: 24px; }
  .about-section { gap: 28px; padding-block: 38px; }
  .tool-button { padding: 11px 16px; font-size: 11px; }
  .tool-display { font-size: 11.8vw; }
  .lap-panel, .laps-panel { padding: 12px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .tool-section { padding-top: 18px; }
}
