/* ==========================================================================
   codinganyway — sub-page layout (legal / guide / use-cases)
   A LIGHTWEIGHT reading layout for all pages OTHER than the 3D landing.
   It does NOT load Three.js. It inherits the portal's dark-space tone and
   typography from the landing (style.css) but is its own, fast, static sheet.

   Used by: /{lang}/kakeru/, /{lang}/kakeru/guide/, /{lang}/kakeru/use-cases/...,
            /{lang}/privacy/, /{lang}/terms/, /{lang}/licenses/

   Pair with the shared header/footer markup template in
   assets/_layout-template.html (copy into each page; GitHub Pages is static
   and has no server-side includes).
   ========================================================================== */

:root {
  /* 2026-07-13 リデザイン: ダーク宇宙 → 明るく健康的な「紙とインク」。
     暖かい紙色の地に、木漏れ日グリーンのアクセント。アプリカードは
     各アプリのアイデンティティ色（--app-*）で彩る。 */
  --bg: #faf8f4;
  --bg-2: #f1ede5;
  --surface: #ffffff;
  --fg: #2b2a26;
  --fg-soft: #45433c;
  --muted: #6e6a60;
  --line: #e7e2d8;
  --accent: #2f6b45; /* leaf green (links / primary) */
  --accent-2: #c05621; /* warm citrus (secondary) */
  --app-kakeru: #3b82f6;
  --app-omoiegaku: #7c3aed;
  --app-neruflow: #0891b2;
  --app-minukutable: #047857;
  --maxw: 720px; /* comfortable reading measure */
}

* {
  box-sizing: border-box;
}

html {
  /* Anchored headings clear the sticky bar when jumped to. */
  scroll-padding-top: 5rem;
}

html,
body {
  margin: 0;
  padding: 0;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%) fixed;
  color: var(--fg);
  font-family:
    'Hiragino Sans', 'Noto Sans JP', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.65;
}

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

/* --- Shared sticky header -------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem clamp(1rem, 5vw, 2rem);
  background: rgba(250, 248, 244, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header__home {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: -0.02em;
  text-transform: lowercase;
  color: var(--fg);
}
.site-header__home:hover {
  color: var(--accent);
  text-decoration: none;
}
.site-header__spacer {
  flex: 1;
}
/* Language switch: the alternate-language link for the SAME page. */
.lang-switch {
  display: inline-flex;
  gap: 0.4rem;
  font-size: 0.8rem;
}
.lang-switch a {
  color: var(--muted);
  padding: 0.15rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.lang-switch a:hover {
  color: var(--fg);
  border-color: var(--accent);
  text-decoration: none;
}
.lang-switch a[aria-current='true'] {
  color: var(--fg);
  border-color: var(--accent);
}
/* Smallest phones: the header carries the Syne wordmark (wide — ~11.4× its
   font-size) plus two language pills, and spelling both languages out by name
   ("日本語" / "English") costs more room than the old "ja" did. Below 400px
   that trio overflows and the whole page scrolls sideways, so tighten it. */
@media (max-width: 400px) {
  .site-header {
    gap: 0.5rem;
    padding-left: 0.9rem;
    padding-right: 0.9rem;
  }
  .site-header__home {
    font-size: 0.85rem;
  }
  .lang-switch {
    font-size: 0.72rem;
    gap: 0.25rem;
  }
  .lang-switch a {
    padding: 0.15rem 0.35rem;
  }
}

/* --- Breadcrumb ----------------------------------------------------------- */
.breadcrumb {
  max-width: var(--maxw);
  margin: 1.5rem auto 0;
  padding: 0 clamp(1.25rem, 6vw, 2rem);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.breadcrumb a {
  color: var(--muted);
}
.breadcrumb a:hover {
  color: var(--fg);
}
.breadcrumb span[aria-hidden] {
  opacity: 0.5;
  margin: 0 0.4rem;
}

/* --- Main reading column --------------------------------------------------- */
.page {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2rem clamp(1.25rem, 6vw, 2rem) 4rem;
}

.page h1 {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  font-size: clamp(1.9rem, 6vw, 3rem);
  margin: 0.5rem 0 0.75rem;
}
.page h2 {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: clamp(1.25rem, 4vw, 1.6rem);
  margin: 2.5rem 0 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--line);
}
.page h3 {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  margin: 1.75rem 0 0.5rem;
}
.page p,
.page li {
  color: var(--fg-soft);
  font-size: 0.95rem;
}
.page ul,
.page ol {
  padding-left: 1.25rem;
}
.page li {
  margin: 0.35rem 0;
}
.page .lede {
  color: var(--muted);
  font-size: 1.05rem;
}
.page .updated {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}
.page code {
  font-size: 0.85em;
  background: #f0ebdf;
  padding: 0.1em 0.4em;
  border-radius: 5px;
}
.page hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2.5rem 0;
}

/* Card grid (use-case indexes, app index, etc.) */
.card-grid {
  display: grid;
  gap: 1rem;
  /* auto-fit (not auto-fill): when a grid holds fewer cards than the row can
     take — the app list is down to one published app — the tiles stretch to
     fill the row instead of leaving phantom empty columns beside them. */
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin: 1.5rem 0;
}
.tile {
  display: block;
  padding: 1.25rem;
  border: 1px solid var(--line);
  /* Per-app identity color: set --tile-accent on the element (falls back to
     the portal green). */
  border-left: 4px solid var(--tile-accent, var(--accent));
  border-radius: 14px;
  background: var(--surface);
  color: var(--fg);
  box-shadow:
    0 1px 2px rgb(60 50 30 / 0.05),
    0 10px 24px -18px rgb(60 50 30 / 0.35);
}
a.tile:hover {
  text-decoration: none;
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--tile-accent, var(--accent)) 45%, var(--line));
  box-shadow:
    0 2px 4px rgb(60 50 30 / 0.06),
    0 16px 32px -16px color-mix(in srgb, var(--tile-accent, var(--accent)) 45%, transparent);
}
/* Upcoming works: visibly "not yet", but still part of the family. */
.tile--soon {
  opacity: 0.72;
  border-style: dashed;
  border-left-style: solid;
  box-shadow: none;
}
.tile__badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  vertical-align: middle;
  background: color-mix(in srgb, var(--tile-accent, var(--accent)) 14%, var(--surface));
  color: color-mix(in srgb, var(--tile-accent, var(--accent)) 75%, var(--fg));
}
.tile {
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.tile h3 {
  margin: 0 0 0.4rem;
  font-size: 1.1rem;
}
.tile p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

/* Embedded Kakeru board (use-case articles): keep aspect, no scroll inside. */
.board-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  margin: 1.5rem 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-2);
}
.board-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.board-open {
  display: inline-block;
  margin-top: 0.25rem;
  font-size: 0.85rem;
}

/* Primary call-to-action button (e.g. "Open in Kakeru"). */
.btn {
  display: inline-block;
  padding: 0.7rem 1.4rem;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
}
.btn:hover {
  text-decoration: none;
  filter: brightness(1.1);
}

/* --- Ad slots (reserved space; real <ins> injected at AdSense go-live) ------
   IMPORTANT: ad height is unknown until fill, so every slot RESERVES height up
   front (min-height) to avoid layout shift (CLS) — the page must not jump when
   an ad lands. Until go-live each slot shows a neutral "Advertisement"
   placeholder; at go-live, drop the AdSense <ins class="adsbygoogle"> inside
   .ad-slot__inner and keep the wrapper's reserved height.

   Policy notes baked into the design:
   - No ad before the page's own content (title + lede come first).
   - Legal pages carry NO ad slots (thin content).
   - The side rail is desktop-only; it collapses on narrow screens. */
.ad-slot {
  margin: 2rem auto;
  max-width: var(--maxw);
  text-align: center;
}
.ad-slot__label {
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.7;
  margin-bottom: 0.4rem;
}
.ad-slot__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  /* Reserve a responsive horizontal-unit height so in-content ads (and their
     absence) take the same room. AdSense responsive ad will fill this box. */
  min-height: 100px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: rgb(60 50 30 / 0.02);
  color: var(--muted);
  font-size: 0.72rem;
}
/* A taller reservation for the in-article "first view" slot (just under the
   lede, before the embedded board), where a larger unit is expected. */
.ad-slot--lead .ad-slot__inner {
  min-height: 250px;
}

/* --- Article layout with a desktop side rail ------------------------------
   Use <div class="article-layout"> wrapping <main class="page article-main">
   and <aside class="article-rail">. On mobile it's a single column and the
   rail is hidden; on wide screens the rail sits to the right and sticks. */
.article-layout {
  display: block;
}
.article-rail {
  display: none; /* mobile: no side ad */
}
.article-rail .ad-slot {
  margin: 0;
}
.article-rail__sticky {
  position: sticky;
  top: 5rem;
}
/* Side rail unit reservation: a 300x600 half-page slot. */
.article-rail .ad-slot__inner {
  width: 300px;
  min-height: 600px;
}

@media (min-width: 1080px) {
  .article-layout {
    display: grid;
    grid-template-columns: minmax(0, var(--maxw)) 300px;
    gap: 2.5rem;
    max-width: calc(var(--maxw) + 300px + 2.5rem);
    margin: 0 auto;
    align-items: start;
  }
  /* In article mode the main column no longer centers itself; the grid does. */
  .article-layout .article-main {
    max-width: none;
    margin: 0;
  }
  .article-rail {
    display: block;
    padding-top: 2rem;
  }
}

/* --- Shared footer --------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 2rem clamp(1.25rem, 6vw, 2rem);
  color: var(--muted);
  font-size: 0.78rem;
}
.site-footer__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  align-items: center;
}
.site-footer a {
  color: var(--muted);
}
.site-footer a:hover {
  color: var(--fg);
}
.site-footer__spacer {
  flex: 1;
}

/* --- Landing (root index) --------------------------------------------------
   The bright, practical front door (2026-07-13: the 3D immersive top was
   retired — git history has it). Reuses the shared tokens/cards above. */
.hero {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(2.5rem, 8vw, 5rem) clamp(1.25rem, 6vw, 2rem) 1rem;
  text-align: left;
}
/* The front doors lead with the name, not with a paragraph about it. The
   earlier hero explained what the site does NOT decide ("用途もかたちも決めて
   いません"), which reads as indecision and leaves nothing behind. So the
   wordmark is the headline, and a single short line sits above it — the only
   prose in the hero. Used on `/`, `/ja/` and `/en/`; the latter two live
   inside .page, hence the paired selectors. */
.hero__tag,
.page .hero__tag {
  font-family: 'Hiragino Sans', 'Noto Sans JP', system-ui, sans-serif;
  font-weight: 700;
  font-size: clamp(0.9rem, 2.6vw, 1.05rem);
  letter-spacing: 0.04em;
  color: var(--accent);
  margin: 0;
}
.wordmark,
.page h1.wordmark {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  text-transform: lowercase;
  letter-spacing: -0.03em;
  line-height: 1;
  /* Syne 800 is wide: "codinganyway" measures 11.45× its font-size. The
     reading column is --maxw minus its clamped side padding, so 7.4vw (capped
     at 3.4rem ≈ 623px of the 656px column) is the largest size that still
     fits on ONE line at every width from 320px up. Do not raise these without
     re-measuring — the name breaking mid-word ("codinganyw / ay") is the
     failure this replaced. No overflow-wrap either: it is one word, and
     letting it break is worse than letting it be smaller. */
  font-size: clamp(1.4rem, 7.4vw, 3.4rem);
  color: var(--fg);
  margin: 0.4rem 0 0;
}
/* The landing's first heading follows the value chips, not body copy, so it
   does not need the full inter-section gap. */
.page > h2:first-child {
  margin-top: 0.5rem;
}
.values {
  max-width: var(--maxw);
  margin: 1.75rem auto 0;
  padding: 0 clamp(1.25rem, 6vw, 2rem);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  list-style: none;
}
.values li {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--fg-soft);
  font-size: 0.82rem;
}
.values li::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.values li:nth-child(2)::before {
  background: var(--accent-2);
}
.values li:nth-child(3)::before {
  background: var(--app-kakeru);
}
.tile__kind {
  display: block;
  margin-top: 0.6rem;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.games-note,
.page .games-note {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0.25rem clamp(1.25rem, 6vw, 2rem) 1rem;
  color: var(--muted);
  font-size: 0.85rem;
}
/* Footnote under the .values chips: those chips describe what is published
   today, not a rule codinganyway binds itself to. */
.values-note {
  max-width: var(--maxw);
  margin: 0.6rem auto 0;
  padding: 0 clamp(1.25rem, 6vw, 2rem);
  color: var(--muted);
  font-size: 0.78rem;
}

/* Respect reduced-motion: kill the only transitions we add. */
@media (prefers-reduced-motion: reduce) {
  .tile {
    transition: none;
  }
  html {
    scroll-behavior: auto;
  }
}

/* --- Cost-item tables (use-case articles) ---------------------------------
   The article's payload is the "often missed" list, so tables must stay
   readable on a phone: the wrapper scrolls sideways, the page never does. */
.table-scroll {
  overflow-x: auto;
  margin: 1.25rem 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  -webkit-overflow-scrolling: touch;
}
.page table {
  border-collapse: collapse;
  width: 100%;
  min-width: 34rem;
  font-size: 0.88rem;
}
.page th,
.page td {
  text-align: left;
  vertical-align: top;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--line);
}
.page thead th {
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
  color: var(--fg);
  font-weight: 700;
  white-space: nowrap;
}
.page tbody tr:last-child td {
  border-bottom: 0;
}
.page td:first-child {
  font-weight: 600;
  color: var(--fg);
}
.page td.amount {
  white-space: nowrap;
  color: var(--muted);
}
.page caption {
  caption-side: top;
  text-align: left;
  padding: 0.6rem 0.85rem 0;
  color: var(--muted);
  font-size: 0.8rem;
}
