:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --fg: #1f1d2b;
  --muted: #5b5870;
  --line: rgba(31, 29, 43, 0.12);
  --accent: #7048e8;
  --header-bg: #5f3dc4;
  /* One colour per home page category, dark enough for white text on it */
  --c-saglik: #c92a2a;
  --c-doga: #2b8a3e;
  --c-uzay: #5f3dc4;
  --c-teknoloji: #1864ab;
  --c-ekonomi: #b35c00;
  --c-tarih: #8f4a24;
  --c-savas: #495057;
  --c-toplum: #c2255c;
  --c-psikoloji: #0b7285;
  --c-diger: #5c636a;
  --gutter: 16px;
  --serif: Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #15142a;
    --surface: rgba(255, 255, 255, 0.07);
    --fg: #f3f0ff;
    --muted: #b9b4d1;
    --line: rgba(243, 240, 255, 0.14);
    --accent: #b197fc;
    --header-bg: #2b1f63;
    --c-saglik: #ff8787;
    --c-doga: #69db7c;
    --c-uzay: #b197fc;
    --c-teknoloji: #74c0fc;
    --c-ekonomi: #ffc078;
    --c-tarih: #e0a77a;
    --c-savas: #ced4da;
    --c-toplum: #faa2c1;
    --c-psikoloji: #66d9e8;
    --c-diger: #adb5bd;
  }
}

:root[data-theme="dark"] {
  --bg: #15142a;
  --surface: rgba(255, 255, 255, 0.07);
  --fg: #f3f0ff;
  --muted: #b9b4d1;
  --line: rgba(243, 240, 255, 0.14);
  --accent: #b197fc;
  --header-bg: #2b1f63;
  --c-saglik: #ff8787;
  --c-doga: #69db7c;
  --c-uzay: #b197fc;
  --c-teknoloji: #74c0fc;
  --c-ekonomi: #ffc078;
  --c-tarih: #e0a77a;
  --c-savas: #ced4da;
  --c-toplum: #faa2c1;
  --c-psikoloji: #66d9e8;
  --c-diger: #adb5bd;
}

/* Sepia reading theme (chosen in the reading settings) */
:root[data-theme="sepia"] {
  --bg: #f4ecd8;
  --surface: rgba(255, 252, 244, 0.85);
  --fg: #3b2f1e;
  --muted: #7a6a52;
  --line: rgba(59, 47, 30, 0.16);
  --accent: #8a4b1c;
  --header-bg: #7a4a22;
}

@media (min-width: 720px) {
  :root { --gutter: 32px; }
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 18px var(--gutter);
  background: var(--header-bg);
  color: #ffffff;
}

/* Header buttons and links are light on the coloured bar; the reading settings panel keeps the page colours */
.site-header .menu-toggle,
.site-header .settings-toggle {
  border-color: rgba(255, 255, 255, 0.45);
  color: #ffffff;
}
.site-header .site-nav a[aria-current="page"],
.site-header .site-nav a:hover,
.site-header .nav-logout:hover { color: #ffe066; }
.site-header .nav-user { color: rgba(255, 255, 255, 0.8); }
.site-header .settings-slot { color: var(--fg); }
.site-header .reader-settings { background: var(--bg); }

.site-title {
  font-family: var(--serif);
  font-size: 22px;
  text-decoration: none;
}

/* Max width is about 80 characters of text */
.wrap {
  max-width: 80ch;
  margin: 0 auto;
  padding: 32px var(--gutter) 64px;
  overflow-wrap: anywhere;
}

/* Home page */
.intro h1 {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(30px, 6vw, 44px);
  line-height: 1.15;
}

.intro p { margin: 0; color: var(--muted); }

.article-list {
  display: grid;
  gap: 14px;
  margin: 32px 0 0;
  padding: 0;
  list-style: none;
}

/* The home page uses the full width for the cards; article text keeps its reading width */
.wrap.wide { max-width: 1120px; }

@media (min-width: 720px) {
  .article-list { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 1024px) {
  .article-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.card {
  display: block;
  height: 100%;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  text-decoration: none;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(31, 29, 43, 0.1);
}

@media (prefers-reduced-motion: reduce) {
  .card { transition: border-color 0.2s; }
  .card:hover { transform: none; }
}

.card-title {
  display: block;
  margin: 6px 0 8px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 21px;
  line-height: 1.3;
}

.card-topic {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.card-meta {
  display: block;
  margin-top: 6px;
  font-size: 14px;
  color: var(--muted);
}

.card-audio { color: var(--accent); font-weight: 600; }

/* Article pages */
.crumb {
  margin: 0 0 8px;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.page-title {
  margin: 0 0 16px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(28px, 5vw, 40px);
  line-height: 1.2;
}

.page-intro {
  margin: 0 0 24px;
  color: var(--muted);
}

.steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 32px;
  padding: 0;
  list-style: none;
}

.steps a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
}

.steps a[aria-current="page"] {
  border-color: var(--fg);
  background: var(--fg);
  color: var(--bg);
}

.body-text p {
  margin: 0 0 1.1em;
  font-family: var(--serif);
  font-size: var(--reader-size, 19px);
  line-height: var(--reader-line, 1.7);
}

:root[data-font="modern"] .body-text p { font-family: var(--sans); }
:root[data-font="book"] .body-text p { font-family: "Palatino Linotype", Palatino, "Book Antiqua", serif; }

/* Every English word shows its Turkish meaning when pressed; key words are underlined */
.key-word,
.gloss-word {
  cursor: pointer;
  border-radius: 3px;
  -webkit-touch-callout: none;
  transition: background-color 0.15s;
}

.key-word {
  text-decoration: underline dotted var(--accent);
  text-underline-offset: 4px;
}

.key-word:hover,
.gloss-word:hover {
  background-color: color-mix(in srgb, var(--accent) 14%, transparent);
}

.key-word:focus-visible,
.gloss-word:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.word-tip {
  position: absolute;
  z-index: 50;
  display: grid;
  gap: 2px;
  max-width: 240px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--fg);
  color: var(--bg);
  font-size: 15px;
  line-height: 1.4;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  pointer-events: none;
}

.word-tip[hidden] { display: none; }

/* Translation of a selected part of the text */
.word-tip.is-wide { max-width: min(420px, calc(100vw - 16px)); }

.tip-note {
  font-size: 12px;
  opacity: 0.75;
}

.tip-gap { margin-top: 6px; }

.translate-button {
  position: absolute;
  z-index: 51;
  padding: 6px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}

.translate-button[hidden] { display: none; }

/* Read-aloud player under the English title; it stays at the top of the window while the page scrolls */
.audio-player {
  position: sticky;
  top: 8px;
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin: 0 0 24px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.audio-player[hidden] { display: none; }

.audio-play {
  min-height: 40px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.audio-play:disabled,
.audio-seek:disabled { opacity: 0.5; cursor: default; }

.audio-seek {
  flex: 1 1 140px;
  min-width: 0;
  accent-color: var(--accent);
}

.audio-time {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.audio-speed button { min-height: 34px; padding: 0 12px; }

/* The word being read aloud */
.is-spoken {
  background-color: #ffe066;
  color: #1f1d2b;
  border-radius: 3px;
  box-shadow: 0 0 0 2px #ffe066;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.btn {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 15px;
  text-decoration: none;
}

.btn:hover { border-color: var(--accent); }

.btn-primary {
  border-color: var(--fg);
  background: var(--fg);
  color: var(--bg);
}

.btn-primary:hover { border-color: var(--accent); background: var(--accent); }

/* Vocabulary cards */
.word-list {
  display: grid;
  gap: 16px;
}

.word-card {
  min-width: 0;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

/* Number, word and Turkish meaning on one line, wrapping on narrow screens */
.word-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
}

.word-num {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.word {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 28px;
  line-height: 1.15;
  color: var(--accent);
}

.meaning-tr {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

.word-def {
  margin: 6px 0 0;
  font-style: italic;
  color: var(--muted);
}

/* The example sentence with its translation under it */
.word-example {
  margin: 14px 0 0;
  padding: 2px 0 2px 14px;
  border-left: 3px solid color-mix(in srgb, var(--accent) 45%, transparent);
}

.word-example p { margin: 0; }
.word-example strong { color: var(--accent); }

.word-example-tr {
  margin-top: 4px !important;
  font-size: 15px;
  color: var(--muted);
}

/* After an article's last page: the next article as a card */
.next-article {
  display: grid;
  grid-template-columns: 96px 1fr;
  align-items: center;
  gap: 16px;
  flex-basis: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  text-decoration: none;
  transition: border-color 0.2s;
}

.next-article:hover { border-color: var(--accent); }

.next-cover {
  display: block;
  width: 96px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 10px;
}

.next-info { display: grid; gap: 2px; min-width: 0; }

.next-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.next-title {
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.25;
}

.next-meta { font-size: 14px; color: var(--muted); }

@media (min-width: 720px) {
  .next-article { grid-template-columns: 160px 1fr; gap: 20px; }
  .next-cover { width: 160px; }
}

/* Reading progress at the top of article pages */
.read-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 60;
  width: 100%;
  height: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  pointer-events: none;
}

.notice { color: var(--muted); }

[hidden] { display: none !important; }

/* Admin panel */
.admin-badge {
  margin-left: 12px;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.wrap.admin { max-width: 900px; }

.admin-form {
  display: grid;
  gap: 16px;
}

.admin-form label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
}

.admin-form input,
.admin-form textarea,
.admin-form select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--fg);
  font: inherit;
  font-size: 15px;
}

.admin-form textarea { resize: vertical; line-height: 1.5; }

.hint {
  font-size: 12px;
  color: var(--muted);
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.admin-toolbar .page-title { margin: 0; }

.admin-subtitle {
  margin: 24px 0 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 24px;
}

.word-row {
  display: grid;
  gap: 12px;
  min-width: 0;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.word-row legend {
  padding: 0 6px;
  font-size: 13px;
  color: var(--muted);
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

button.btn {
  font: inherit;
  color: var(--fg);
  background: transparent;
  cursor: pointer;
}

button.btn-primary {
  background: var(--fg);
  border-color: var(--fg);
  color: var(--bg);
}

.form-message {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.form-message.is-error { color: #b3261e; }

.admin-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

button.btn-danger {
  color: #b3261e;
  border-color: #b3261e;
}

.cover-field {
  display: grid;
  gap: 12px;
  min-width: 0;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.cover-field legend {
  padding: 0 6px;
  font-size: 13px;
  color: var(--muted);
}

.cover-preview {
  display: block;
  width: 100%;
  max-width: 360px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 10px;
}

/* Reader menu */
.site-title { color: inherit; text-decoration: none; }

.menu-toggle {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  color: var(--fg);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.site-nav {
  display: none;
  width: 100%;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  padding-top: 12px;
}

.site-nav.is-open { display: flex; }

.site-nav a,
.nav-logout {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
}

.site-nav a[aria-current="page"] { color: var(--accent); }
.site-nav a:hover,
.nav-logout:hover { color: var(--accent); }

.nav-user {
  font-size: 14px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

@media (min-width: 720px) {
  .menu-toggle { display: none; }
  /* Menu links on the right, followed by the reading settings button */
  .site-nav {
    order: 1;
    display: flex;
    width: auto;
    margin-left: auto;
    flex-direction: row;
    align-items: center;
    gap: 22px;
    padding-top: 0;
  }
  .site-header .settings-toggle { order: 2; margin-left: 8px; }
  .settings-slot { order: 3; }
}

/* Footer */
.site-footer {
  display: grid;
  gap: 18px;
  margin-top: 64px;
  padding: 32px var(--gutter);
  border-top: 1px solid var(--line);
}

.footer-title {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: 20px;
}

.footer-text,
.footer-copy {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 14px;
}

.footer-nav a { color: inherit; text-decoration: none; }
.footer-nav a:hover { color: var(--accent); }

@media (min-width: 720px) {
  .site-footer {
    grid-template-columns: 1fr auto;
    align-items: center;
  }
  .footer-copy { grid-column: 1 / -1; }
}

/* Sign-up and login pages */
.wrap.account { max-width: 480px; }

.account-switch {
  margin-top: 20px;
  font-size: 14px;
  color: var(--muted);
}

.account-switch a { color: var(--accent); }

/* Users list in the admin panel */
.users-panel { margin-top: 48px; }

/* Visitor numbers in the admin panel: two tables side by side, stacked on narrow screens */
.visits-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: 20px;
}

/* Long article titles wrap instead of pushing the numbers off screen */
.visits-grid .users-table td:first-child { white-space: normal; }

.visits-heading {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
}

/* Read-aloud audio of the article in the admin panel */
.audio-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 8px 0 4px;
}

.audio-actions label.btn { cursor: pointer; }

.audio-status { margin: 0; font-weight: 600; }
.audio-status.is-warning { color: #b45309; }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.users-table th,
.users-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.users-table th {
  font-weight: 600;
  color: var(--muted);
}

.users-table td { overflow-wrap: anywhere; }

/* Every cell stays on one line; the table scrolls sideways when it is wider than the screen */
.users-table th,
.users-table td { white-space: nowrap; }

/* Reading settings panel in the header */
.settings-toggle {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  color: var(--fg);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

/* On phones the reading settings button sits on the right, before the menu button */
@media (max-width: 719px) {
  .site-header .settings-toggle { margin-left: auto; }
}

.settings-slot { width: 100%; }

.reader-settings {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.settings-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.settings-label {
  min-width: 110px;
  font-size: 14px;
  color: var(--muted);
}

.settings-row > button {
  min-width: 40px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  cursor: pointer;
}

.settings-value {
  min-width: 64px;
  text-align: center;
  font-size: 14px;
}

.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.segmented button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.segmented button[aria-pressed="true"] {
  border-color: var(--fg);
  background: var(--fg);
  color: var(--bg);
}

.reader-settings .btn {
  justify-self: start;
  background: var(--bg);
  color: var(--fg);
  cursor: pointer;
}

/* Level question */
.level-dialog {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: var(--gutter);
  background: rgba(20, 18, 30, 0.45);
}

.level-card {
  display: grid;
  gap: 16px;
  width: min(440px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  background-color: var(--bg);
  text-align: center;
}

.level-card h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 30px;
}

.level-text {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.level-options {
  display: grid;
  gap: 10px;
}

.level-card .btn { cursor: pointer; }

/* Saved words and review */
.save-word {
  margin-top: 14px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.save-word[data-state="saved"] {
  border-color: var(--accent);
  color: var(--accent);
}

.save-word:disabled { opacity: 0.6; cursor: wait; }

.learn-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.learn-item {
  display: grid;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.learn-item-word {
  font-family: var(--serif);
  font-size: 22px;
  color: var(--accent);
}

.learn-meta {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.flashcard {
  display: grid;
  gap: 16px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}

.flash-word {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 40px;
  color: var(--accent);
  overflow-wrap: anywhere;
}

.flash-back p { margin: 0 0 8px; }

.flash-actions,
.learn-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.stats-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stat-card {
  display: grid;
  gap: 4px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.stat-card strong {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 28px;
}

.stat-card span {
  font-size: 13px;
  color: var(--muted);
}

@media (min-width: 720px) {
  .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Welcome message on the home page */
.welcome {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-content: center;
  gap: 12px;
  padding: var(--gutter);
  background: var(--bg);
  color: var(--fg);
  text-align: center;
  transition: opacity 0.6s ease;
  cursor: pointer;
}

.welcome.is-hidden { opacity: 0; pointer-events: none; }

.welcome h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(36px, 7vw, 64px);
  line-height: 1.1;
}

.welcome p {
  margin: 0;
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  .welcome { transition: none; }
}

/* Article cover images */
.card-cover {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 14px;
}

.card-body { display: block; }

.article-cover {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 16px;
  margin: 0 0 24px;
}

/* The first article is shown as a large card on wide screens */
.article-list li.featured { grid-column: 1 / -1; }

/* Category buttons on the home page */
.category-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0 0;
}

.category-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--fg);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.category-chip:hover { border-color: var(--accent); }

.category-chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}

.category-count {
  font-size: 12px;
  opacity: 0.7;
}

/* Category colours: a stripe and label on each card, and a tinted button in the filter row.
   Level buttons use the level colours. "Tümü" keeps the site accent. */
[data-kategori="saglik"], .category-chip[data-slug="saglik"] { --cat: var(--c-saglik); }
[data-kategori="doga"], .category-chip[data-slug="doga"] { --cat: var(--c-doga); }
[data-kategori="uzay"], .category-chip[data-slug="uzay"] { --cat: var(--c-uzay); }
[data-kategori="teknoloji"], .category-chip[data-slug="teknoloji"] { --cat: var(--c-teknoloji); }
[data-kategori="ekonomi"], .category-chip[data-slug="ekonomi"] { --cat: var(--c-ekonomi); }
[data-kategori="tarih"], .category-chip[data-slug="tarih"] { --cat: var(--c-tarih); }
[data-kategori="savas"], .category-chip[data-slug="savas"] { --cat: var(--c-savas); }
[data-kategori="toplum"], .category-chip[data-slug="toplum"] { --cat: var(--c-toplum); }
[data-kategori="psikoloji"], .category-chip[data-slug="psikoloji"] { --cat: var(--c-psikoloji); }
[data-kategori="diger"], .category-chip[data-slug="diger"] { --cat: var(--c-diger); }
.category-chip[data-slug="easy"] { --cat: var(--c-doga); }
.category-chip[data-slug="intermediate"] { --cat: var(--c-ekonomi); }
.category-chip[data-slug="advanced"] { --cat: var(--c-uzay); }

[data-kategori] .card { border-top: 5px solid var(--cat); }
[data-kategori] .card:hover { border-color: var(--cat); }
[data-kategori] .card-topic { color: var(--cat); }

.category-chip[data-slug]:not([data-slug=""]) {
  border-color: transparent;
  background: color-mix(in srgb, var(--cat) 14%, transparent);
  color: var(--fg);
}
.category-chip[data-slug]:not([data-slug=""]):hover { border-color: var(--cat); }
.category-chip[data-slug]:not([data-slug=""])[aria-pressed="true"] {
  border-color: var(--cat);
  background: var(--cat);
  color: var(--bg);
}

.category-bar + .article-list { margin-top: 20px; }
.category-bar + .category-bar { margin-top: 10px; }

/* Reading level on each card: green easy, amber intermediate, purple advanced */
.card-level {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
}

.level-easy { background: rgba(47, 158, 68, 0.14); color: #2b8a3e; }
.level-intermediate { background: rgba(230, 119, 0, 0.14); color: #b35c00; }
.level-advanced { background: rgba(112, 72, 232, 0.12); color: var(--accent); }

:root[data-theme="dark"] .level-easy { color: #8ce99a; }
:root[data-theme="dark"] .level-intermediate { color: #ffc078; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .level-easy { color: #8ce99a; }
  :root:not([data-theme]) .level-intermediate { color: #ffc078; }
}

.level-note {
  margin: 16px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.level-note + .article-list { margin-top: 12px; }

@media (min-width: 720px) {
  .featured .card {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 28px;
    align-items: center;
  }
  .featured .card-cover { margin-bottom: 0; aspect-ratio: 4 / 3; }
  .featured .card-title { font-size: 30px; margin-top: 8px; }
}
