/* =========================================================================
   Noko — noko.me  •  shared stylesheet (home + all subpages)
   -------------------------------------------------------------------------
   - Dark is the default. Light mode = <html data-theme="light"> (see js/site.js).
   - Two languages live in the markup at once; CSS shows one set based on
     <html data-lang="en|ja">. No reloads, no framework.
   - Colors are CSS custom properties so you can re-skin everything in one place.
   - This is the only stylesheet the home page needs. Blog posts also load
     css/blog.css for article typography.
   ========================================================================= */

/* ---- Theme tokens : DARK (default) ------------------------------------- */
:root {
  /* Fantasy-purple, Lorcana-ish. Not pitch black. SWAP freely. */
  --bg-1: #1a1130;          /* base */
  --bg-2: #2a1c44;          /* glow */
  --bg-3: #100a1f;          /* deepest corner */
  --surface: rgba(255, 255, 255, 0.05);
  --surface-2: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.12);
  --text: #f3f0fb;
  --text-muted: #c5bcdd;
  --accent: #ffcf5c;        /* gold */
  --accent-2: #b9a4ff;      /* lavender */
  --glow: rgba(185, 164, 255, 0.45);
  --link: #ffd97a;

  /* Shape / motion */
  --radius: 14px;
  --radius-sm: 10px;
  --maxw: 980px;            /* short, focused page width */
  --ease: cubic-bezier(.2, .7, .3, 1);

  /* SWAP fonts here. System stack = zero network requests, instant render. */
  --font-body: "Hiragino Maru Gothic ProN", "Segoe UI", system-ui,
               -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-head: "Hiragino Maru Gothic ProN", "Trebuchet MS", system-ui, sans-serif;
}

/* ---- Theme tokens : LIGHT --------------------------------------------- */
:root[data-theme="light"] {
  --bg-1: #efe9dc;          /* parchment */
  --bg-2: #f7f2e7;
  --bg-3: #e6ddcb;
  --surface: rgba(60, 40, 90, 0.05);
  --surface-2: rgba(60, 40, 90, 0.09);
  --border: rgba(60, 40, 90, 0.16);
  --text: #2a2140;
  --text-muted: #5a4f72;
  --accent: #b07d1a;
  --accent-2: #6a4fb0;
  --glow: rgba(106, 79, 176, 0.30);
  --link: #7a4fce;
}

/* ---- Reset-ish --------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--text);
  line-height: 1.6;
  /* Instant, weightless background. The pattern tile is optional polish. */
  background:
    radial-gradient(1100px 620px at 50% -8%, var(--bg-2), transparent 60%),
    radial-gradient(800px 520px at 92% 4%, rgba(90, 209, 200, 0.10), transparent 55%),
    linear-gradient(180deg, var(--bg-1), var(--bg-3));
  background-attachment: fixed;
}
/* Subtle tiling motif over the gradient. Comment this block out to disable,
   or point it at your own images/background.svg. Kept tiny + low-opacity. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("/images/pattern.svg");
  background-size: 120px 120px;
  opacity: 1;
  pointer-events: none;
  z-index: 0;
}
body > * { position: relative; z-index: 1; }

img { display: block; max-width: 100%; height: auto; }
a { color: var(--link); }

/* Accessible "visually hidden" helper (labels for screen readers). */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0); clip-path: inset(50%);
  overflow: hidden; white-space: nowrap;
}

/* =========================================================================
   Language switching: both languages are in the DOM; show one.
   Wrap text in <span class="i18n" data-en="..." data-ja="..."></span>
   OR use <span lang="en"> / <span lang="ja"> pairs.
   ========================================================================= */
:root[data-lang="en"] [lang="ja"] { display: none; }
:root[data-lang="ja"] [lang="en"] { display: none; }
/* data-attribute style (good for inline text): */
.i18n::after { content: attr(data-en); }
:root[data-lang="ja"] .i18n::after { content: attr(data-ja); }

/* =========================================================================
   Page shell
   ========================================================================= */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 18px; }

/* ---- Header ------------------------------------------------------------ */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px 18px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1.15rem;
}
.brand img {
  width: 44px; height: 44px;
  border-radius: 50%;
  transition: transform .25s var(--ease);
}
.brand:hover img { transform: rotate(-6deg) scale(1.06); }

.header-actions { display: inline-flex; align-items: center; gap: 6px; }

/* Icon buttons (socials + toggles). Inline SVG inherits currentColor. */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  transition: color .2s var(--ease), background .2s var(--ease), transform .2s var(--ease);
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover,
.icon-btn:focus-visible {
  color: var(--accent);
  background: var(--surface);
  transform: translateY(-1px);
  outline: none;
}
.icon-btn:active { transform: translateY(0) scale(.94); }

/* Language toggle = globe icon + short label. Never wrap or shrink it. */
.lang-btn {
  width: auto;
  padding: 0 10px;
  gap: 5px;
  font-weight: 700;
  font-size: .82rem;
  white-space: nowrap;
  flex-shrink: 0;
}
.lang-btn svg { flex-shrink: 0; }
/* Theme toggle: show moon in dark mode, sun in light mode. */
.theme-btn .icon-sun { display: none; }
:root[data-theme="light"] .theme-btn .icon-moon { display: none; }
:root[data-theme="light"] .theme-btn .icon-sun { display: inline; }

/* =========================================================================
   Hero / intro
   ========================================================================= */
.hero { text-align: center; padding: 8px 0 6px; }
.hero h1 {
  font-family: var(--font-head);
  font-size: clamp(2rem, 7vw, 3.4rem);
  line-height: 1.05;
  margin: 6px 0 10px;
  color: var(--text);
  text-shadow: 0 2px 18px var(--glow);
}
.hero p {
  max-width: 40ch;
  margin: 0 auto;
  color: var(--text-muted);
  font-size: clamp(1rem, 3.4vw, 1.18rem);
}

/* =========================================================================
   Sections + galleries
   ========================================================================= */
.section { margin: 30px 0; }
.section > h2 {
  font-family: var(--font-head);
  text-align: center;
  font-size: clamp(1.2rem, 4.5vw, 1.6rem);
  margin: 0 0 14px;
  color: var(--accent);
}

/* The key rule the brief asked for:
   a single horizontal row that RESIZES instead of WRAPPING, and never
   forces horizontal scrolling. Each item flexes equally and may shrink. */
.gallery {
  display: flex;
  flex-wrap: nowrap;          /* never break into a second row */
  gap: clamp(8px, 1.6vw, 16px);
  align-items: flex-start;
  justify-content: center;
}
.gallery .item {
  flex: 1 1 0;                /* share width equally */
  min-width: 0;               /* allow shrinking below content size */
  max-width: 200px;           /* don't blow up huge on wide screens */
  display: block;
  text-decoration: none;
  color: inherit;
}

/* Card / thumbnail: keeps aspect ratio, comes "alive" on hover & touch. */
.card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transition: transform .22s var(--ease), box-shadow .22s var(--ease);
}
.card img { width: 100%; height: 100%; object-fit: cover; }

/* Aspect ratios per gallery so rows stay tidy as they scale. */
.books   .card { aspect-ratio: 2 / 3; }     /* book covers   */
.apps    .card { aspect-ratio: 9 / 19.5; }  /* phone screens */
.posts   .card { aspect-ratio: 16 / 10; }   /* blog thumbs   */

/* Hover only on devices that truly hover (keeps phones from sticking). */
@media (hover: hover) {
  .item:hover .card,
  .item:focus-visible .card {
    transform: translateY(-6px) scale(1.04);
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.35), 0 0 0 2px var(--accent-2),
                0 0 22px var(--glow);
  }
}
/* Touch / keyboard feedback so it feels alive everywhere. */
.item:active .card { transform: translateY(-2px) scale(1.02); }
.item:focus-visible { outline: none; }

/* Optional caption under a thumbnail (blog posts). */
.posts .caption {
  display: block;
  margin-top: 6px;
  font-size: .82rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.3;
  /* keep captions from forcing the row taller in weird ways */
  overflow: hidden;
}

/* =========================================================================
   Footer — Mailing list & helpful tips (NOT a "newsletter")
   ========================================================================= */
.site-footer {
  margin-top: 40px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.signup {
  max-width: 620px;
  margin: 0 auto;
  padding: 26px 18px 18px;
  text-align: center;
}
.signup h2 {
  font-family: var(--font-head);
  font-size: clamp(1.1rem, 4vw, 1.4rem);
  margin: 0 0 4px;
  color: var(--accent);
}
.signup .blurb { margin: 0 0 14px; color: var(--text-muted); font-size: .95rem; }

.signup-form {
  display: flex;
  flex-wrap: wrap;            /* this row MAY wrap — it's a form, not the gallery */
  gap: 8px;
  justify-content: center;
}
.signup-form input {
  flex: 1 1 160px;
  min-width: 0;
  padding: 11px 14px;
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.signup-form input::placeholder { color: var(--text-muted); }
.signup-form input:focus-visible {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px var(--glow);
}

/* "Join" button built purely with CSS (no image asset). */
.btn {
  flex: 0 0 auto;
  padding: 11px 22px;
  font: inherit;
  font-weight: 800;
  color: #2a1a05;
  background: linear-gradient(180deg, #ffe08a, var(--accent));
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.25), 0 6px 16px var(--glow);
  transition: transform .15s var(--ease), box-shadow .15s var(--ease), filter .15s var(--ease);
}
.btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25); }

.signup .status { min-height: 1.2em; margin: 10px 0 0; font-size: .9rem; }
.signup .status.ok { color: var(--accent-2); }
.signup .status.err { color: #ff9b9b; }
.signup .fineprint { margin: 14px 0 0; font-size: .76rem; color: var(--text-muted); }
.signup .fineprint a { color: inherit; }

.colophon {
  text-align: center;
  padding: 16px;
  font-size: .76rem;
  color: var(--text-muted);
}

/* =========================================================================
   Responsive — favor iPhone portrait, degrade gracefully upward.
   The gallery already scales; here we just relax spacing on small screens.
   ========================================================================= */
@media (max-width: 600px) {
  .wrap { padding: 0 12px; }
  .site-header { padding: 10px 12px; }
  .brand .brand-name { display: none; }   /* keep just the face on tight screens */
  .icon-btn { width: 34px; height: 34px; }
  .lang-btn { width: auto; }               /* keep room for the globe + label */
  .icon-btn svg { width: 18px; height: 18px; }
  .gallery { gap: 6px; }
  .posts .caption { font-size: .72rem; }
}

/* Respect users who prefer less motion. */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto; }
}
