/*
Theme Name: Ajankohta Signal
Theme URI: https://ajankohtamedia.fi/
Author: Aaro Lehtovaara
Description: Ajankohtamedia - itsenainen suomalainen julkaisu. Helsinki Signal -ilme: skarppi uutispoyta, tiivis typografia, rehelliset signaalit.
Version: 1.0.0
Requires at least: 6.2
Requires PHP: 7.4
Tested up to: 6.6
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: ajankohta-signal
Tags: news, editorial, custom-logo, accessibility-ready, translation-ready
*/

/* ==========================================================================
   1. Design tokens - Helsinki Signal
   ========================================================================== */
:root {
  --ink: #0A0C10;
  --paper: #FFFFFF;
  --surface: #F4F6F8;
  --line: #D9DEE6;
  --muted: #596273;
  --brand: #0B5FFF;
  --signal: #FFB000;
  --alert: #D92D20;

  --cat-politiikka: #1D4ED8;
  --cat-tekniikka: #0891B2;
  --cat-blogi: #B45309;
  --cat-4: #7C3AED;
  --cat-5: #047857;
  --cat-6: #C2410C;
  --cat-7: #BE123C;
  --cat-8: #4338CA;
  --cat-9: #0F766E;
  --cat-10: #475569;

  --display: "Arial Narrow", "Roboto Condensed", Arial, system-ui, -apple-system, "Segoe UI", sans-serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --shell: 1240px;
  --gutter: 22px;
  --measure: 720px;
  --breakout: 940px;

  --radius: 2px;
  --radius-sm: 2px;
  --line-hair: 1px;

  --t-fast: 120ms;
  --t-base: 160ms;
  --t-slow: 180ms;
  --ease: cubic-bezier(.2, .6, .2, 1);
}

/* ==========================================================================
   2. Local webfont
   ========================================================================== */
@font-face {
  font-family: "Source Serif 4";
  src: url("assets/fonts/source-serif-4-latin.woff2") format("woff2-variations"),
       url("assets/fonts/source-serif-4-latin.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ==========================================================================
   3. Base and reset
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body.aj-site {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img, svg, video, iframe { max-width: 100%; height: auto; }
img { border: 0; }
figure { margin: 0; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 .5em;
  text-wrap: balance;
}

h1 { font-size: clamp(32px, 4.4vw, 44px); line-height: 1.09; font-weight: 800; }
h2 { font-size: clamp(24px, 2.6vw, 32px); line-height: 1.14; }
h3 { font-size: 24px; line-height: 1.18; }
h4 { font-size: 19px; line-height: 1.3; }

p { margin: 0 0 1em; }

a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

time { font-variant-numeric: tabular-nums; }

hr { border: 0; border-top: var(--line-hair) solid var(--line); margin: 30px 0; }

::selection { background: var(--brand); color: #fff; }

/* Focus: always visible, never removed. */
:focus-visible,
a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--signal);
  outline-offset: 2px;
  border-radius: var(--radius);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  padding: 12px 18px;
  background: var(--ink);
  color: var(--paper);
  font: 700 14px/1.2 var(--display);
  letter-spacing: .02em;
}
.skip-link:focus {
  left: 8px;
  top: 8px;
  outline: 3px solid var(--signal);
}

.sr-only,
.screen-reader-text {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
  min-width: 0;
}

.aj-main { display: block; min-width: 0; }

.eyebrow {
  display: inline-block;
  font: 700 11px/1.4 var(--display);
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--muted);
}

.signal-rule {
  display: inline-block;
  width: 22px;
  height: 3px;
  background: var(--signal);
  vertical-align: middle;
  margin-right: 8px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 11px 20px;
  background: var(--brand);
  color: #fff;
  border: 1px solid var(--brand);
  border-radius: var(--radius);
  font: 700 15px/1.2 var(--display);
  text-decoration: none;
  transition: background var(--t-base) var(--ease), color var(--t-base) var(--ease), border-color var(--t-base) var(--ease);
}
.button:hover { background: var(--ink); border-color: var(--ink); color: #fff; text-decoration: none; }
.button--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.button--ghost:hover { background: var(--ink); color: #fff; }

.text-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  font: 700 14px/1.3 var(--display);
  letter-spacing: .01em;
  color: var(--brand);
  text-decoration: none;
  border-bottom: 2px solid var(--signal);
  padding-bottom: 2px;
}
.text-link:hover { color: var(--ink); }

/* ==========================================================================
   4. Masthead and navigation
   ========================================================================== */
.aj-header {
  position: relative;
  z-index: 60;
  background: var(--paper);
  border-bottom: var(--line-hair) solid var(--line);
}

.header-top {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 74px;
  padding-block: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  flex: none;
}
.brand:hover { text-decoration: none; }

.brand-mark { display: block; width: 34px; height: 34px; flex: none; color: var(--brand); }
.brand-mark svg { display: block; width: 100%; height: 100%; }

.brand-word {
  display: inline-flex;
  align-items: baseline;
  font-family: var(--display);
  font-size: 27px;
  line-height: 1;
  letter-spacing: -0.035em;
  font-weight: 800;
}
.brand-word .w-1 { font-weight: 800; }
.brand-word .w-sep {
  display: inline-block;
  width: 3px;
  height: 22px;
  margin: 0 7px 0 6px;
  background: var(--brand);
  transform: translateY(2px);
}
.brand-word .w-2 { font-weight: 600; }
.brand-word .w-dot { color: var(--signal); font-weight: 800; }

.header-tagline {
  margin: 0;
  font: 600 12px/1.35 var(--display);
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  max-width: 190px;
  border-left: 2px solid var(--signal);
  padding-left: 10px;
}

.header-tools { display: flex; align-items: center; gap: 12px; margin-left: auto; }

.header-search { flex: 1 1 260px; max-width: 330px; }

.search-form { margin: 0; }
.search-form .search-row {
  display: flex;
  border: var(--line-hair) solid var(--line);
  background: var(--paper);
  border-radius: var(--radius);
  transition: border-color var(--t-base) var(--ease);
}
.search-form .search-row:focus-within { border-color: var(--brand); }
.search-form label { display: block; font: 700 12px/1.4 var(--display); color: var(--muted); margin-bottom: 6px; letter-spacing: .04em; }
.search-form input[type="search"] {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 11px 13px;
  font: 400 15px/1.3 var(--sans);
  color: var(--ink);
  min-height: 44px;
}
.search-form input[type="search"]::placeholder { color: var(--muted); }
.search-form button {
  flex: none;
  border: 0;
  background: var(--ink);
  color: var(--paper);
  font: 700 13px/1 var(--display);
  letter-spacing: .04em;
  padding: 0 15px;
  min-width: 56px;
  min-height: 44px;
  cursor: pointer;
  transition: background var(--t-base) var(--ease);
}
.search-form button:hover { background: var(--brand); }

.menu-toggle {
  display: none;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  min-width: 44px;
  padding: 10px 14px;
  background: var(--paper);
  border: var(--line-hair) solid var(--line);
  border-radius: var(--radius);
  font: 700 13px/1.2 var(--display);
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink);
  cursor: pointer;
}
.menu-toggle[aria-expanded="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.menu-lines { position: relative; display: block; width: 16px; height: 10px; flex: none; }
.menu-lines::before, .menu-lines::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: currentColor;
}
.menu-lines::before { top: 0; }
.menu-lines::after { bottom: 0; }

.aj-nav {
  border-top: var(--line-hair) solid var(--line);
  background: var(--paper);
}
.nav-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 46px;
}
.nav-topics {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-topics::-webkit-scrollbar { display: none; }
.nav-topics a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  font: 700 14px/1 var(--display);
  letter-spacing: .01em;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.nav-topics a:hover { color: var(--brand); border-bottom-color: var(--brand); }
.nav-topics a[aria-current="page"] { color: var(--brand); border-bottom-color: var(--signal); }
.nav-topics a.nav-more { color: var(--muted); }

.header-author {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-left: auto;
  min-height: 44px;
  padding: 4px 10px 4px 4px;
  border: var(--line-hair) solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
  flex: none;
}
.header-author:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.header-author img { width: 32px; height: 32px; border-radius: var(--radius); object-fit: cover; display: block; }
.header-author span { font: 700 12px/1.2 var(--display); }

/* Mobile panel */
.menu-panel {
  position: absolute;
  inset: 100% 0 auto 0;
  background: var(--paper);
  border-bottom: 3px solid var(--ink);
  box-shadow: 0 18px 40px rgba(10, 12, 16, .14);
  padding-block: 20px 26px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
}
.menu-panel[hidden] { display: none; }
.menu-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.menu-top h2 { margin: 0; font-size: 22px; }
.menu-close {
  min-height: 44px;
  padding: 10px 14px;
  background: var(--surface);
  border: var(--line-hair) solid var(--line);
  border-radius: var(--radius);
  font: 700 13px/1.2 var(--display);
  letter-spacing: .04em;
  cursor: pointer;
  color: var(--ink);
  text-transform: uppercase;
}
.menu-panel .search-form { margin-bottom: 18px; }
.menu-topics { display: grid; gap: 0; border-top: var(--line-hair) solid var(--line); margin-bottom: 18px; }
.menu-topics a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 6px 4px;
  border-bottom: var(--line-hair) solid var(--line);
  font: 700 17px/1.2 var(--display);
  color: var(--ink);
  text-decoration: none;
}
.menu-topics a:hover { color: var(--brand); }
.menu-topics a span { font: 400 12px/1 var(--sans); color: var(--muted); }
.menu-links { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.menu-links a { display: inline-flex; align-items: center; min-height: 44px; font: 600 14px/1.3 var(--display); color: var(--ink); text-decoration: none; }
.menu-links a:hover { color: var(--brand); }

body.menu-is-open { overflow: hidden; }

/* ==========================================================================
   5. Footer
   ========================================================================== */
.aj-footer {
  margin-top: 54px;
  background: var(--ink);
  color: #C9CFDA;
  font-size: 14px;
  padding-block: 44px 22px;
}
.aj-footer a { color: #E7EBF2; text-decoration: none; }
.aj-footer a:hover { color: #fff; text-decoration: underline; }
.aj-footer .brand { color: #fff; }
.aj-footer .brand-mark { color: var(--signal); }
.aj-footer h2 {
  font: 700 12px/1.4 var(--display);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #fff;
  margin: 0 0 12px;
}
.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 30px 28px;
  padding-bottom: 32px;
  border-bottom: var(--line-hair) solid #2A2F3A;
}
.footer-brand p { margin: 12px 0 14px; max-width: 30ch; line-height: 1.6; }
.footer-brand .brand-word { font-size: 23px; }
.footer-list { display: grid; gap: 0; }
.footer-list a {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 4px 0;
  border-bottom: var(--line-hair) solid #22262F;
}
.footer-list a:last-child { border-bottom: 0; }
.footer-headlines a { display: block; padding: 9px 0; border-bottom: var(--line-hair) solid #22262F; font: 600 14px/1.4 var(--display); }
.footer-headlines time { display: block; font: 400 12px/1.4 var(--sans); color: #8C95A5; margin-top: 3px; }
.footer-note { margin: 14px 0 0; font-size: 12px; line-height: 1.6; color: #8C95A5; }
.footer-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  font: 700 11px/1.3 var(--display);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--signal);
}
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding-top: 18px;
  font-size: 12.5px;
  color: #8C95A5;
}
.footer-bottom nav { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.footer-bottom a { display: inline-flex; align-items: center; min-height: 34px; }
.skip-to-top {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: var(--line-hair) solid #2A2F3A;
  border-radius: var(--radius);
  font: 700 12px/1 var(--display);
  letter-spacing: .05em;
  text-transform: uppercase;
}

/* ==========================================================================
   6. Honest signals and status strip
   ========================================================================== */
.signal-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  padding-block: 11px;
  border-bottom: var(--line-hair) solid var(--line);
  font: 600 13px/1.4 var(--display);
  color: var(--muted);
}
.signal-row .signal-date { color: var(--ink); text-transform: capitalize; }
.signal-row .signal-sep { color: var(--line); }
.signal-row a { display: inline-flex; align-items: center; min-height: 32px; color: var(--brand); text-decoration: none; }
.signal-row a:hover { text-decoration: underline; }

.status-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: 0;
  border-block: var(--line-hair) solid var(--line);
  background: var(--surface);
  margin: 34px 0 0;
}
.status-strip > div,
.status-strip > a {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 18px 20px;
  border-right: var(--line-hair) solid var(--line);
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
}
.status-strip > :last-child { border-right: 0; }
.status-strip strong { font: 800 24px/1.05 var(--display); letter-spacing: -0.03em; }
.status-strip span { font: 600 12.5px/1.4 var(--display); letter-spacing: .02em; color: var(--muted); }
.status-strip a:hover { background: var(--paper); color: var(--brand); }

/* Verified official feed (disabled by default, fail-closed) */
.wire-block {
  margin-top: 34px;
  border: var(--line-hair) solid var(--line);
  border-top: 3px solid var(--ink);
  background: var(--paper);
}
.wire-intro { padding: 22px 22px 16px; border-bottom: var(--line-hair) solid var(--line); }
.wire-intro h2 { margin: 8px 0 8px; font-size: clamp(22px, 2.2vw, 28px); }
.wire-intro p { margin: 0; color: var(--muted); font-size: 14.5px; max-width: 68ch; }
.wire-list { display: grid; }
.wire-list article { padding: 16px 22px; border-bottom: var(--line-hair) solid var(--line); }
.wire-list article:last-child { border-bottom: 0; }
.wire-list h3 { font-size: 18px; margin: 6px 0 0; }
.wire-list h3 a { color: var(--ink); text-decoration: none; }
.wire-list h3 a:hover { color: var(--brand); text-decoration: underline; }
.wire-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font: 600 12px/1.4 var(--display); color: var(--muted); letter-spacing: .02em; }
.wire-check { padding: 12px 22px; margin: 0; background: var(--surface); font-size: 12.5px; color: var(--muted); }

/* ==========================================================================
   7. Motion and reduced motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   8. Responsive chrome
   ========================================================================== */
@media (max-width: 1080px) {
  .footer-grid { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr); }
  .header-tagline { display: none; }
}

@media (max-width: 900px) {
  .menu-toggle { display: inline-flex; }
  .aj-nav { display: none; }
  .header-search { display: none; }
  .header-top { min-height: 64px; }
  .brand-word { font-size: 24px; }
  .footer-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

@media (max-width: 560px) {
  :root { --gutter: 16px; }
  .brand-word { font-size: 21px; }
  .brand-word .w-sep { height: 18px; margin: 0 5px; }
  .brand-mark { width: 30px; height: 30px; }
  .menu-toggle span:not(.menu-lines) { display: none; }
  .menu-toggle { padding: 10px 12px; }
  .footer-grid { grid-template-columns: minmax(0, 1fr); gap: 26px; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
  .status-strip > div, .status-strip > a { border-right: 0; border-bottom: var(--line-hair) solid var(--line); }
  .status-strip > :last-child { border-bottom: 0; }
}