/* ============================================================
   KALNITISH — Homepage Stylesheet
   Fonts: Oswald (display) + Inter (body) via Google Fonts
   ============================================================ */


/* =============================================================
   1. DESIGN TOKENS
   ============================================================= */
:root {
  /* Light mode palette */
  --color-bg:           #FFFFFF;
  --color-surface:      #F4F6FA;
  --color-card:         #FFFFFF;
  --color-border:       #E6EAF2;
  --color-text:         #111827;
  --color-text-muted:   #6B7280;

  /* Accent */
  --color-accent:       #1A5CFF;
  --color-accent-hover: #1248D4;

  /* Header / footer — always dark */
  --color-header-bg:    #0F1117;

  /* Buttons */
  --btn-sec-border:     #1A5CFF;
  --btn-sec-text:       #1A5CFF;

  /* Shadows */
  --shadow-card:        0 2px 12px rgba(0,0,0,0.07), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-card-hover:  0 8px 28px rgba(0,0,0,0.12), 0 2px 6px rgba(0,0,0,0.06);

  /* Shape */
  --radius:    12px;
  --radius-sm: 6px;

  /* Type */
  --font-display: 'Oswald', sans-serif;
  --font-body:    'Inter', system-ui, -apple-system, sans-serif;

  /* Motion */
  --t: 0.2s ease;
}

[data-theme="dark"] {
  --color-bg:         #0D0F14;
  --color-surface:    #13161F;
  --color-card:       #1A1E2A;
  --color-border:     #272D3E;
  --color-text:       #EEF0F7;
  --color-text-muted: #8B93A8;

  --btn-sec-border:   #4D80FF;
  --btn-sec-text:     #4D80FF;

  --shadow-card:       0 2px 16px rgba(0,0,0,0.35), 0 1px 4px rgba(0,0,0,0.2);
  --shadow-card-hover: 0 8px 32px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.3);
}


/* =============================================================
   2. RESET
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  transition:
    background-color var(--t),
    color var(--t);
}

img  { display: block; max-width: 100%; }
ul, ol { list-style: none; }
a  { color: var(--color-accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }


/* =============================================================
   3. LAYOUT UTILITY
   ============================================================= */
.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 20px;
}


/* =============================================================
   4. HEADER
   ============================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--color-header-bg);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  height: 52px;
  gap: 24px;
}

/* Logo */
.site-logo {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #FFFFFF;
  flex-shrink: 0;
}
.site-logo:hover { text-decoration: none; opacity: 0.8; }

/* Nav */
.site-nav ul {
  display: flex;
  gap: 28px;
}
.site-nav a {
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(255,255,255,0.68);
  letter-spacing: 0.025em;
  transition: color var(--t);
}
.site-nav a:hover { color: #FFFFFF; text-decoration: none; }
.site-nav a:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Header action buttons */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.theme-toggle {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  color: rgba(255,255,255,0.75);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--t), border-color var(--t);
}
.theme-toggle:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.4);
}
.theme-toggle:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Hamburger — hidden on desktop */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 6px;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: rgba(255,255,255,0.75);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.hamburger:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 4px;
}


/* =============================================================
   5. CARD BASE
   ============================================================= */
.card {
  background: var(--color-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--color-border);
  transition:
    background-color var(--t),
    border-color var(--t),
    box-shadow var(--t);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 28px 18px;
  border-bottom: 1px solid var(--color-border);
}
.card-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--color-text);
  text-transform: uppercase;
}
.card-footer {
  padding: 16px 28px;
  border-top: 1px solid var(--color-border);
}


/* =============================================================
   6. BUTTONS
   ============================================================= */
.btn {
  display: inline-block;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.025em;
  text-decoration: none;
  transition:
    background var(--t),
    color var(--t),
    border-color var(--t),
    box-shadow var(--t),
    transform 0.12s ease;
  border: 2px solid transparent;
  line-height: 1.4;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

.btn-primary {
  background: var(--color-accent);
  color: #FFFFFF;
}
.btn-primary:hover {
  background: var(--color-accent-hover);
  box-shadow: 0 4px 14px rgba(26,92,255,0.38);
}

.btn-secondary {
  background: transparent;
  color: var(--btn-sec-text);
  border-color: var(--btn-sec-border);
}
.btn-secondary:hover {
  background: rgba(26,92,255,0.07);
}


/* =============================================================
   7. HERO SECTION
   ============================================================= */
.section-hero {
  padding: 36px 0 28px;
}

/* Two-column hero card */
.hero-card {
  display: grid;
  grid-template-columns: 240px 1fr;
}

/* --- Poster panel ------------------------------------------- */
.hero-poster {
  position: relative;
  background: #0F1117; /* fallback if image missing */
  min-height: 340px;
}

.poster-frame {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 340px;
  overflow: hidden;
  /* Gradient fallback — shows if image is missing */
  background: linear-gradient(155deg, #12162A 0%, #1E2850 55%, #111828 100%);
}

.poster-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: brightness(0.82);
}

/* ★ SIGNATURE ELEMENT
   A diagonal clip-path wedge bleeds from the poster
   into the content column — a panel-break device.
   The pseudo-element is the card background color,
   creating the illusion of an angled edge.           */
.hero-poster::after {
  content: '';
  position: absolute;
  top: 0;
  right: -1px;
  bottom: 0;
  width: 52px;
  background: var(--color-card);
  /* bottom-right triangle — creates the diagonal cut */
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
  transition: background-color var(--t);
  z-index: 1;
}

.poster-badge {
  position: absolute;
  bottom: 18px;
  left: 16px;
  z-index: 2;
  background: var(--color-accent);
  color: #FFFFFF;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 4px;
}

/* --- Hero text --------------------------------------------- */
.hero-content {
  padding: 32px 32px 32px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
}

.hero-eyebrow {
  font-size: 0.73rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-accent);
}

.hero-title {
  font-family: var(--font-display);
  font-size: 3.2rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.0;
  color: var(--color-text);
}

.hero-desc {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  line-height: 1.75;
  max-width: 460px;
}
.hero-desc em { color: var(--color-text); font-style: normal; font-weight: 500; }

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  align-items: center;
}
.hero-meta .dot { opacity: 0.35; line-height: 1; }

.hero-cta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}


/* =============================================================
   8. CHAPTERS SECTION
   ============================================================= */
.section-chapters {
  padding: 0 0 24px;
}

.chapter-count {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.chapter-list {
  padding: 4px 0;
}

.chapter-row {
  border-bottom: 1px solid var(--color-border);
}
.chapter-row:last-child { border-bottom: none; }

.chapter-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 28px;
  color: var(--color-text);
  transition: background var(--t);
  min-height: 48px; /* comfortable tap target */
}
.chapter-link:hover {
  background: var(--color-surface);
  text-decoration: none;
}
.chapter-link:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: -2px;
}

/* Chapter number — accent gutter, like a manga ToC */
.ch-num {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--color-accent);
  min-width: 26px;
}
.ch-title {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 500;
}
.ch-date {
  font-size: 0.76rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}


/* =============================================================
   9. UPDATES SECTION
   ============================================================= */
.section-updates {
  padding: 0 0 24px;
}

.update-list { padding: 4px 0; }

.update-row {
  display: flex;
  gap: 20px;
  padding: 13px 28px;
  border-bottom: 1px solid var(--color-border);
  align-items: baseline;
}
.update-row:last-child { border-bottom: none; }

.update-date {
  font-size: 0.76rem;
  color: var(--color-text-muted);
  min-width: 88px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.update-text {
  font-size: 0.9rem;
  color: var(--color-text);
  line-height: 1.55;
}


/* =============================================================
   10. FOOTER
   ============================================================= */
.site-footer {
  background: var(--color-header-bg);
  color: rgba(255,255,255,0.55);
  margin-top: 28px;
  padding: 36px 0 24px;
}
.footer-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px 48px;
  align-items: start;
}
.footer-brand { grid-column: 1 / 2; }
.footer-logo {
  display: block;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #FFFFFF;
  margin-bottom: 6px;
}
.footer-brand p { font-size: 0.82rem; }
.footer-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}
.footer-nav a {
  font-size: 0.83rem;
  color: rgba(255,255,255,0.55);
  transition: color var(--t);
}
.footer-nav a:hover { color: #FFFFFF; text-decoration: none; }
.footer-nav a:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: 2px;
}
.footer-copy {
  grid-column: 1 / -1;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.3);
  border-top: 1px solid rgba(255,255,255,0.07);
  padding-top: 14px;
  margin-top: 8px;
}


/* =============================================================
   11. RESPONSIVE — MOBILE (≤ 660px)
   ============================================================= */
@media (max-width: 660px) {

  /* Show hamburger, hide inline nav */
  .hamburger { display: flex; }

  .site-nav {
    position: absolute;
    top: 52px;
    left: 0;
    right: 0;
    background: var(--color-header-bg);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }
  .site-nav.open { max-height: 260px; }
  .site-nav ul {
    flex-direction: column;
    gap: 0;
    padding: 6px 0 14px;
  }
  .site-nav a {
    display: block;
    padding: 12px 20px;
    font-size: 0.95rem;
  }

  /* Hero: stack vertically */
  .hero-card {
    grid-template-columns: 1fr;
  }
  .hero-poster {
    min-height: 200px;
  }
  .poster-frame {
    min-height: 200px;
  }

  /* Diagonal cut flips to bottom edge on mobile */
  .hero-poster::after {
    top: auto;
    right: 0;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 36px;
    clip-path: polygon(0 100%, 100% 100%, 100% 0);
  }

  .hero-content {
    padding: 20px 20px 24px;
    gap: 12px;
  }
  .hero-title { font-size: 2.4rem; }

  /* Chapter / update rows: tighter padding */
  .chapter-link { padding: 13px 20px; }
  .update-row   { padding: 13px 20px; flex-direction: column; gap: 3px; }
  .card-header  { padding: 18px 20px 14px; }
  .card-footer  { padding: 14px 20px; }

  /* Footer: single column */
  .footer-inner {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .footer-nav {
    align-items: flex-start;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px 18px;
  }
}


/* =============================================================
   12. REDUCED MOTION
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}
