/* JLPTSuccess landing page (level picker).
   Self-contained CSS for the top-level domain. Each level subdirectory
   ships its own complete CSS bundle (the existing N5/css/main.css and
   N4/css/main.css from the level apps). */

:root {
  --brand: #14452a;
  --brand-link: #1a5c38;
  --text: #1a1a1a;
  --text-muted: #555;
  --bg: #fafafa;
  --card-bg: #ffffff;
  --card-border: #e5e5e5;
  /* Tea-green tint for the top header band — picks up a soft JP-cultural
     thread (matcha / sencha-shop signage palette) and gives the page a
     visible top edge without the "dark lid" weight of the original
     forest-green strip. Brand forest-green logo on this = ~6.5:1 (AA). */
  --header-bg: #cfd8b5;
  --card-hover-border: #14452a;
  --card-disabled-bg: #f4f4f4;
  --card-disabled-text: #999;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --radius: 12px;
  --text-base: 16px;
  --font-stack: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #f0f0f0;
    --text-muted: #aaa;
    --bg: #1a1a1a;
    --card-bg: #242424;
    --card-border: #333;
    --card-hover-border: #4a8a64;
    --card-disabled-bg: #1f1f1f;
    --card-disabled-text: #555;
    /* Dark-mode brand: brighten the forest-green so logo + accents
       have AAA contrast on the near-black background. The light-mode
       value (#14452a) measures only 1.5:1 against #1a1a1a — unreadable.
       This sage-green keeps the forest-family identity and clears 7:1. */
    --brand: #5da57e;
    --brand-link: #7cc99e;
    /* Dark-mode header: deep moss tint that mirrors the light-mode tea-green
       relationship — present enough to delineate, soft enough not to glare.
       Sage-green logo on this = ~5:1 (AA). */
    --header-bg: #2a3a2c;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  /* Breathing space above the header band — the page bg shows through
   * here so the tea-green header reads as a deliberate band, not as the
   * very-first thing painted at the viewport top. */
  padding-top: 16px;
  font: 400 var(--text-base)/1.55 var(--font-stack);
  font-size: max(16px, var(--text-base));  /* iOS auto-zoom prevention */
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.skip-link {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip-link:focus {
  position: static;
  width: auto;
  height: auto;
  background: var(--brand);
  color: white;
  padding: 0.5rem 1rem;
}

/* Tea-green header band — a muted earthen-green tint anchors the top of
   the page without the visual weight of a dark-forest-green strip. The
   brand lockup (forest green via inline-SVG currentColor) reads cleanly
   against the tint. The color change itself delineates header-from-main;
   no hairline needed. */
.app-header {
  background: var(--header-bg);
  color: var(--brand);
  padding: 1rem 1.5rem;
  /* 2026-05-14: header now also hosts a fullscreen toggle on the right
     (parity with N5 sub-app). Flex layout: brand pinned left, action
     buttons pinned right. */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.header-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
/* Header icon buttons — ported from N5 main.css (.app-header .icon-btn).
   Same 32px square + monochrome SVG + hairline-on-hover convention so the
   landing page and N5 sub-app share visual vocabulary. */
.app-header .icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: 0.5px solid transparent;
  border-radius: 4px;
  color: var(--brand);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.app-header .icon-btn:hover {
  background: rgba(20, 69, 42, 0.08);
  border-color: rgba(20, 69, 42, 0.18);
}
.app-header .icon-btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.app-header .icon-btn .icon { width: 18px; height: 18px; display: block; }
@media (prefers-color-scheme: dark) {
  .app-header .icon-btn:hover {
    background: rgba(93, 165, 126, 0.12);
    border-color: rgba(93, 165, 126, 0.25);
  }
}
.brand h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1;
  display: flex;
  align-items: center;
}
.brand-link {
  color: var(--brand);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.brand-link:hover { text-decoration: none; opacity: 0.75; }
/* Inline SVG inherits color via currentColor → both the bars and the
   wordmark render in the brand forest-green. */
.brand-logo {
  display: block;
  height: 32px;
  width: auto;
  color: var(--brand);
}

main { flex: 1; padding: 2rem 1rem; }

.levels-page { max-width: 960px; margin: 0 auto; }

.levels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.level-card {
  background: var(--card-bg);
  border: 2px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text);
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  min-height: 180px;
}
.level-card.is-available:hover {
  border-color: var(--card-hover-border);
  box-shadow: var(--shadow-md);
}
.level-card.is-available:active { transform: scale(0.98); }
.level-card.is-available:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

.level-card.is-disabled {
  background: var(--card-disabled-bg);
  color: var(--card-disabled-text);
  cursor: not-allowed;
}

.level-card-code {
  font-size: 2rem;
  font-weight: 600;
  color: var(--brand);
  letter-spacing: 0.02em;
}
.level-card.is-disabled .level-card-code { color: var(--card-disabled-text); }

.level-card-label {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 500;
}
.level-card-desc {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  flex: 1;
  max-height: 4lh;
  overflow: hidden;
  text-overflow: ellipsis;
}
.level-card-arrow {
  position: absolute;
  right: 1.5rem;
  bottom: 1.5rem;
  font-size: 1.25rem;
  color: var(--brand);
}
.level-card-status {
  font-size: 0.85rem;
  font-style: italic;
  color: var(--card-disabled-text);
  margin-top: auto;
}

.app-footer {
  background: var(--card-bg);
  border-top: 1px solid var(--card-border);
  padding: 0;
  display: flex;
  flex-direction: column;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.app-footer .footer-meta,
.app-footer .footer-nav {
  padding: 0.5rem 1.5rem;
}
.app-footer .footer-meta {
  align-self: flex-start;
}
.app-footer .footer-nav {
  align-self: flex-end;
}
@media (min-width: 769px) {
  .app-footer {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

.app-footer-legacy {
  background: var(--card-bg);
  border-top: 1px solid var(--card-border);
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.footer-meta { font-weight: 500; }
.footer-nav a {
  color: var(--text-muted);
  text-decoration: none;
  margin-left: 1rem;
}
.footer-nav a:hover { color: var(--brand); text-decoration: underline; }

@media (max-width: 768px) {
  main { padding: 1rem; }
  .brand-logo { height: 26px; }
  .levels-grid { grid-template-columns: 1fr; }
  .level-card { min-height: 150px; padding: 1.25rem; }
  .level-card-code { font-size: 1.75rem; }
  .app-footer {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }
  .footer-nav a { margin: 0 0.5rem; }
}
