/*
Theme Name: Simple Webnovel – Nordic Frost
Theme URI: https://example.com/simple-webnovel-nordic-frost
Author: Simple Webnovel
Description: A calm, spacious, Scandinavian-minimal webnovel theme. Airy off-white / ice-blue surfaces, a cool light-blue accent, clean geometric sans typography, and a comfortable reading experience with Light, Frost, and Night reader tones.
Version: 1.0.0
Requires at least: 5.9
Tested up to: 6.5
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: simple-webnovel-nordic-frost
Tags: blog, one-column, custom-logo, custom-menu, full-width-template, threaded-comments, translation-ready
*/

/* ---- Design tokens (light default) ---- */
:root {
  --accent: #3b82a0;
  --accent-deep: #2b6a86;
  --accent-tint: #e7f2f6;

  --bg: #f6f9fb;
  --surface: #ffffff;
  --surface-2: #eef4f7;
  --text: #23343c;
  --text-soft: #5b6f79;
  --line: #dce7ec;
  --line-strong: #c3d5dd;

  --shadow-1: 0 1px 3px rgba(35, 80, 110, 0.08);
  --shadow-2: 0 10px 30px rgba(35, 80, 110, 0.10);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;

  --max: 1120px;
  --reader-width: 720px;
  --reader-size: 19px;
  --reader-leading: 1.9;

  --radius: 14px;
  --radius-sm: 9px;
  --transition: 0.18s ease;
}

/* Frost reader tone: soft blue-grey */
:root[data-tone="frost"] {
  --bg: #eef4f8;
  --surface: #f7fbfd;
  --surface-2: #e3eef4;
  --text: #1f3340;
  --text-soft: #55707e;
  --line: #d3e2ea;
  --line-strong: #b9d0dc;
  --accent-tint: #e7f2f6;
}
:root[data-tone="frost"] body,
body[data-tone="frost"] {
  --bg: #eaf2f6;
  --surface: #f6fafc;
  --surface-2: #ddeaf1;
  --text: #1e333f;
  --text-soft: #4f6b79;
  --line: #cfdfe8;
  --line-strong: #b5ccd8;
}

/* Night reader tone: dark navy */
:root[data-tone="night"] {
  --bg: #121c22;
  --surface: #16232b;
  --surface-2: #1c2c36;
  --text: #dceae9;
  --text-soft: #95abb4;
  --line: #2a3d48;
  --line-strong: #3a5160;
  --accent: #6fb6d4;
  --accent-deep: #8fcae3;
  --accent-tint: #17303c;
  --shadow-1: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 10px 30px rgba(0, 0, 0, 0.45);
}
body[data-tone="night"] {
  --bg: #121c22;
  --surface: #16232b;
  --surface-2: #1c2c36;
  --text: #dceae9;
  --text-soft: #95abb4;
  --line: #2a3d48;
  --line-strong: #3a5160;
  --accent: #6fb6d4;
  --accent-deep: #8fcae3;
  --accent-tint: #17303c;
  --shadow-1: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 10px 30px rgba(0, 0, 0, 0.45);
}

/* ---- Base ---- */
* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background var(--transition), color var(--transition);
}

img { max-width: 100%; height: auto; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-deep); text-decoration: underline; }

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; color: var(--text); }

.nf-wrap {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: 24px;
}

/* Skip link */
.nf-skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--accent);
  color: #fff;
  padding: 8px 16px;
  border-radius: 0 0 var(--radius-sm) 0;
}
.nf-skip:focus { left: 0; }

/* ---- Header ---- */
.nf-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}
.nf-header__inner {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 72px;
}
.nf-brand { display: flex; align-items: center; line-height: 0; }
.nf-logo { line-height: 0; }
.nf-logo img { height: var(--logo-height-desktop); width: auto; }
.nf-brand__link { display: inline-flex; align-items: center; gap: 10px; color: var(--text); }
.nf-brand__link:hover { text-decoration: none; color: var(--text); }
.nf-brand__mark {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 18px;
}
.nf-brand__name { font-weight: 700; font-size: 20px; letter-spacing: -0.01em; }

.nf-nav { margin-left: auto; }
.nf-nav ul { display: flex; align-items: center; gap: 6px; margin: 0; padding: 0; list-style: none; }
.nf-nav a {
  display: inline-block;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-weight: 600;
  font-size: 0.95rem;
}
.nf-nav a:hover { color: var(--accent-deep); background: var(--surface-2); text-decoration: none; }
.nf-nav .current-menu-item > a { color: var(--accent); background: var(--accent-tint); }

.nf-menu-toggle {
  display: none;
  margin-left: auto;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

/* ---- Main ---- */
.nf-main { padding: 48px 0 72px; }

/* ---- Masthead ---- */
.nf-masthead { text-align: center; margin-bottom: 44px; }
.nf-masthead__label {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-tint);
  padding: 5px 14px;
  border-radius: 999px;
  margin-bottom: 18px;
}
.nf-masthead__title { font-size: clamp(2rem, 5vw, 3.2rem); margin: 0 0 12px; }
.nf-masthead__sub { color: var(--text-soft); font-size: 1.1rem; margin: 0; }
.nf-masthead--compact { margin-bottom: 36px; }

/* ---- Novel grid ---- */
.nf-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}
.nf-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition), box-shadow var(--transition);
}
.nf-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-2); }
.nf-card__cover { display: block; aspect-ratio: 3 / 4; overflow: hidden; background: var(--surface-2); }
.nf-card__cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.3s ease; }
.nf-card:hover .nf-card__cover img { transform: scale(1.04); }
.nf-card__cover--blank {
  display: grid;
  place-items: center;
  font-size: 2.4rem;
  color: var(--line-strong);
  background: linear-gradient(160deg, var(--surface-2), var(--accent-tint));
  text-decoration: none;
}
.nf-card__cover--blank:hover { text-decoration: none; color: var(--accent); }
.nf-card__body { padding: 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.nf-card__title { font-size: 1.15rem; margin: 0; }
.nf-card__title a { color: var(--text); }
.nf-card__title a:hover { color: var(--accent-deep); }
.nf-card__desc {
  color: var(--text-soft);
  font-size: 0.94rem;
  margin: 0;
  line-height: 1.6;
  flex: 1;
}
.nf-card__read {
  align-self: flex-start;
  display: inline-block;
  margin-top: 6px;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--accent);
}
.nf-card__read:hover { color: var(--accent-deep); }

/* ---- Buttons ---- */
.nf-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.nf-btn:hover { text-decoration: none; transform: translateY(-1px); }
.nf-btn--primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-1); }
.nf-btn--primary:hover { background: var(--accent-deep); color: #fff; }
.nf-btn--ghost {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line-strong);
}
.nf-btn--ghost:hover { border-color: var(--accent); color: var(--accent-deep); background: var(--accent-tint); }

/* ---- Pagination ---- */
.nf-pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 48px;
}
.nf-pagination a,
.nf-pagination span {
  display: inline-grid;
  place-items: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-soft);
  font-weight: 600;
}
.nf-pagination a:hover { border-color: var(--accent); color: var(--accent-deep); text-decoration: none; background: var(--accent-tint); }
.nf-pagination .current { background: var(--accent); border-color: var(--accent); color: #fff; }
.nf-pagination .dots { border-color: transparent; background: transparent; }

/* Empty */
.nf-empty { text-align: center; color: var(--text-soft); padding: 48px 0; }

/* ---- Novel detail (hero) ---- */
.nf-hero {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 44px;
  align-items: start;
  margin-bottom: 56px;
}
.nf-hero__cover { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-2); }
.nf-hero__cover img { width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block; }
.nf-hero__cover--blank {
  aspect-ratio: 3/4;
  display: grid;
  place-items: center;
  font-size: 4rem;
  color: var(--line-strong);
  background: linear-gradient(160deg, var(--surface-2), var(--accent-tint));
}
.nf-hero__info { display: flex; flex-direction: column; gap: 16px; }
.nf-hero__kicker { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
.nf-hero__title { font-size: clamp(1.9rem, 4vw, 2.8rem); margin: 0; }
.nf-hero__meta { color: var(--text-soft); font-weight: 600; margin: 0; }
.nf-hero__desc { color: var(--text-soft); font-size: 1.02rem; line-height: 1.75; }
.nf-hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }

/* ---- Catalog ---- */
.nf-catalog__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.nf-catalog__title { margin: 0; font-size: 1.4rem; }
.nf-catalog__tools { display: flex; align-items: center; gap: 12px; color: var(--text-soft); font-size: 0.9rem; }
.nf-catalog__tools label { display: inline-flex; align-items: center; gap: 6px; }
.nf-catalog__tools select,
.nf-catalog__tools input,
.nf-catalog__tools button {
  font: inherit;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  color: var(--text);
}
.nf-catalog__tools button { font-weight: 700; cursor: pointer; border-color: var(--accent); color: var(--accent); }
.nf-catalog__tools button:hover { background: var(--accent); color: #fff; }

.nf-chapters { list-style: none; margin: 0; padding: 0; counter-reset: nf;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.nf-chapters li {
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
  overflow: hidden;
}
.nf-chapters li:last-child { border: 1px solid var(--line); }
.nf-chapters a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  color: var(--text);
  position: relative;
}
.nf-chapters a:hover { background: var(--surface-2); color: var(--accent-deep); text-decoration: none; }
.nf-chapters__title { font-weight: 600; }
.nf-chapters__go { color: var(--line-strong); font-size: 1.4rem; }
.nf-chapters a:hover .nf-chapters__go { color: var(--accent); }

.nf-pagination--catalog { margin-top: 32px; }

/* ---- Reader ---- */
.nf-reader {
  max-width: var(--reader-width);
  margin-inline: auto;
  position: relative;
}
.nf-progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 3px;
  background: transparent;
  z-index: 60;
}
.nf-progress__bar {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--accent);
  transform-origin: left center;
  transform: scaleX(0);
}
.nf-reader__head { text-align: center; margin-bottom: 40px; margin-top: 12px; }
.nf-reader__kicker {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-tint);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.nf-reader__title { font-size: clamp(1.6rem, 3.5vw, 2.2rem); margin: 0; }

.nf-reader__settings {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  padding: 14px 18px;
  margin-bottom: 36px;
}
.nf-reader__settings summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--text);
  font-size: 0.95rem;
  list-style: none;
}
.nf-reader__settings summary::-webkit-details-marker { display: none; }
.nf-reader__settings summary::after { content: "▾"; margin-left: 8px; color: var(--text-soft); }
.nf-reader__settings[open] summary::after { content: "▴"; }
.nf-reader__settings-inner {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}
.nf-reader__settings label {
  display: grid;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-soft);
}
.nf-reader__settings input[type="range"] { accent-color: var(--accent); }
.nf-reader__tones { display: flex; flex-wrap: wrap; gap: 8px; }
.nf-reader__tones button {
  flex: 1;
  font: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 9px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  transition: all var(--transition);
}
.nf-reader__tones button:hover { border-color: var(--accent); color: var(--accent-deep); }
.nf-reader__tones button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

.nf-reader__body { margin-top: 4px; }
.nf-reader__content {
  font-family: var(--font-sans);
  font-size: var(--reader-size);
  line-height: var(--reader-leading);
  color: var(--text);
}
.nf-reader__content p { margin: 0 0 1.4em; }

/* Serif body font toggle via data-font on reader */
.nf-reader[data-font="serif"] .nf-reader__content,
[data-font="serif"] .nf-reader__content {
  font-family: var(--font-serif);
}

.nf-reader__end {
  text-align: center;
  color: var(--text-soft);
  font-style: italic;
  margin: 48px 0 8px;
  letter-spacing: 0.05em;
}
.nf-reader__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  margin-top: 32px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

/* ---- Footer ---- */
.nf-footer {
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 36px 0;
  margin-top: 40px;
}
.nf-footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}
.nf-footer__brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; }
.nf-footer__mark { color: var(--accent); }
.nf-footer__copy { color: var(--text-soft); font-size: 0.9rem; }

/* ---- Reader body tints (scope by tone) ---- */
body[data-tone="night"] .nf-card,
body[data-tone="night"] .nf-header,
body[data-tone="night"] .nf-footer,
body[data-tone="night"] .nf-settings { background: var(--surface); }
body[data-tone="night"] .nf-reader__content { color: var(--text); }

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .nf-grid { grid-template-columns: repeat(2, 1fr); }
  .nf-hero { grid-template-columns: 1fr; }
  .nf-hero__cover { max-width: 340px; }
  .nf-catalog__head { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 640px) {
  .nf-header__inner { height: 60px; }
  .nf-logo img { height: var(--logo-height-mobile); }

  .nf-menu-toggle { display: inline-block; }
  .nf-nav {
    position: fixed;
    inset: 60px 0 auto 0;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-2);
    padding: 12px 24px 16px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.25s ease, opacity 0.2s ease;
  }
  .nf-nav.is-open { max-height: 80vh; opacity: 1; overflow: auto; }
  .nf-nav ul { flex-direction: column; align-items: stretch; gap: 2px; }
  .nf-nav a { display: block; text-align: center; padding: 12px; }

  .nf-main { padding: 36px 0 56px; }
  .nf-grid { grid-template-columns: 1fr; gap: 22px; }
  .nf-hero { gap: 28px; }
  .nf-reader__nav { flex-direction: column; }
  .nf-reader__nav .nf-btn { width: 100%; justify-content: center; }
  .nf-footer__inner { flex-direction: column; align-items: flex-start; }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .nf-card:hover { transform: none; }
  .nf-btn:hover { transform: none; }
  .nf-card__cover img { transition: none; }
}