/* Essel — site styles, version B. The sky stays the protagonist; the type behaves like a printed star atlas.
   Three families with one job each: headings = Mincho, reading = Gothic, data labels = mono (Latin only).
   The sky is the only poetry that is never read aloud: facts sit on plates, everything else floats. */
:root {
  --bg: #04050f;
  --ink: #f4f1ea;
  --text: #dfe2ec;
  --muted: #b7bed0;
  --amber: #eccb93;
  --cyan: #fff0d0;  /* focus ring and the LAB key button (eggs.js reads this name) */
  --line: rgba(236, 203, 147, 0.28);
  --glass: #070916;  /* opaque: no backdrop blur over the moving sky, and nothing shows through the dock */
  --plate: rgba(6, 8, 20, 0.76);
  --f-logo: 'Cinzel', 'Times New Roman', serif;
  --f-head: 'Mochiy Pop One', 'Hiragino Maru Gothic ProN', 'Yu Gothic', sans-serif;
  --f-body: 'Zen Kaku Gothic New', 'Hiragino Sans', 'Noto Sans JP', system-ui, sans-serif;
  /* Japanese falls through to the body face, never to the system's monospace (MS Gothic on Windows) */
  --f-mono: 'IBM Plex Mono', 'Zen Kaku Gothic New', 'Hiragino Sans', 'Noto Sans JP', ui-monospace, monospace;
  --dock-h: 56px;
  --edge: 24px;      /* the one left edge: logo, text and footer all start here */
  --col: 640px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.9;
  overflow-x: hidden;
  text-autospace: normal;
  -webkit-tap-highlight-color: transparent;
}
::selection { background: rgba(236, 203, 147, 0.35); }
/* break Japanese between phrases, not inside words */
h1, h2, p, dd, li, .desc { word-break: auto-phrase; line-break: strict; text-wrap: pretty; }
a { color: inherit; text-underline-offset: 4px; text-decoration-color: var(--line); }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; border-radius: 3px; }
main:focus { outline: none; }

/* ---- sky ---- */
#sky { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; }

/* Content floats above the sky. Empty space inside sections lets taps fall through to the sky;
   text, links and buttons keep pointer events so they stay selectable and clickable.
   Only the sky page does this: the privacy and 404 pages (main.doc) are ordinary documents. */
main:not(.doc), .star, .star .in { pointer-events: none; }
.star .in > *, .star .in a, .star .in button { pointer-events: auto; }

/* ---- skip link ---- */
.skip { position: fixed; left: 12px; top: -60px; z-index: 20; padding: 10px 14px; border-radius: 6px; background: var(--amber); color: #1a1204; font-weight: 700; text-decoration: none; transition: top 0.2s; }
.skip:focus { top: 12px; }

/* ---- header ---- */
.top {
  position: fixed; z-index: 5; left: 0; right: 0; top: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: calc(14px + env(safe-area-inset-top, 0px)) max(var(--edge), env(safe-area-inset-right, 0px)) 18px max(var(--edge), env(safe-area-inset-left, 0px));
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(4, 5, 15, 0.92) 0%, rgba(4, 5, 15, 0.6) 55%, rgba(4, 5, 15, 0) 100%);
}
.brand {
  pointer-events: auto;
  display: inline-flex; align-items: center; gap: 12px; min-height: 44px;
  font-family: var(--f-logo); font-weight: 600; font-size: 17px; letter-spacing: 0.36em; color: var(--ink); text-decoration: none;
}
.brand::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 12px var(--amber); }
/* language switch: JA / EN, top right, opposite the logo */
.lang { pointer-events: auto; display: inline-flex; align-items: center; font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.14em; }
.lang a { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; color: var(--dim, #8a96b2); text-decoration: none; text-shadow: 0 0 6px var(--bg), 0 0 3px var(--bg); }
.lang a[aria-current] { color: var(--ink); }
.lang a:hover, .lang a:focus-visible { color: var(--amber); }
.lang .sep { color: var(--dim, #8a96b2); opacity: 0.6; }
/* the scroll cue lives just above the dock, where the thumb and the eye already are */
.hint {
  position: fixed; left: 50%; bottom: calc(var(--dock-h) + 26px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  margin: 0; font-size: 12px; letter-spacing: 0.14em; white-space: nowrap; color: var(--text); transition: opacity 0.6s;
  text-shadow: 0 0 6px var(--bg), 0 0 3px var(--bg);
}
.hint .arrow { display: inline-block; animation: bob 2.4s ease-in-out infinite; }
.hint.off { opacity: 0; }
@keyframes bob { 50% { transform: translateY(3px); } }

/* ---- sections (stars) ---- */
main { position: relative; z-index: 1; }
.star { min-height: 100svh; display: flex; align-items: center; }
/* the footer starts behind the dock, so at the end of the page the last heading rests clear of the logo */
.star:last-child { min-height: 90svh; }
.star .in { position: relative; z-index: 0; width: 100%; padding: 104px var(--edge) calc(var(--dock-h) + 56px); }
.star .in > * { max-width: var(--col); }
/* a soft dark pool under the text column, so a bright Milky Way behind it never fights the words */
.star .in::before { content: ''; position: absolute; z-index: -1; left: 0; right: 0; top: 60px; bottom: 40px; pointer-events: none;
  background: radial-gradient(ellipse 80% 62% at 50% 50%, rgba(4, 5, 15, 0.78), rgba(4, 5, 15, 0.46) 45%, rgba(4, 5, 15, 0) 72%); }
#top { align-items: flex-end; }
#top .in { padding-bottom: calc(var(--dock-h) + 74px); }

.eyebrow { display: flex; align-items: center; gap: 14px; margin: 0 0 14px; font-family: var(--f-mono); font-size: 12px; line-height: 1.5; letter-spacing: 0.22em; color: var(--amber); }
.eyebrow::after { content: ''; flex: 1; height: 1px; background: linear-gradient(to right, var(--line), rgba(236, 203, 147, 0)); }
/* letter-spacing 0 and line-height 1.2: the stardust lands on the real glyphs only if the metrics match sky.js */
h1, h2 { margin: 0; font-family: var(--f-head); line-height: 1.2; font-weight: 400; letter-spacing: 0; text-autospace: no-autospace; color: var(--ink); transition: opacity 0.8s; text-shadow: 0 1px 2px rgba(4, 5, 15, 0.9), 0 0 6px rgba(4, 5, 15, 0.6); }
h1 { font-size: clamp(32px, 9.4vw, 76px); animation: rise 0.7s ease-out 0.5s both; }
h2 { font-size: clamp(30px, 7.6vw, 52px); }
/* The hero heading is timed by CSS, not by the script: it can never appear, vanish when sky.js arrives on a slow line, and come back.
   Section headings still wait for their stardust. */
@keyframes rise { from { opacity: 0; } to { opacity: 1; } }
.dust-pending h2 { opacity: 0; }

.lead { margin: 20px 0 0; color: var(--text); max-width: 33em; text-shadow: 0 1px 2px rgba(4, 5, 15, 0.9), 0 0 4px rgba(4, 5, 15, 0.7); }
.note { margin: 14px 0 0; color: var(--muted); font-size: 13.5px; line-height: 1.8; text-shadow: 0 1px 2px rgba(4, 5, 15, 0.9), 0 0 4px rgba(4, 5, 15, 0.7); }
/* the invitation is transparent to the pointer: pressing the words themselves also gives a star */
.star .in > .invite { display: flex; align-items: center; gap: 10px; margin: 18px 0 0; color: var(--amber); font-size: 14px; letter-spacing: 0.04em; pointer-events: none; text-shadow: 0 1px 2px rgba(4, 5, 15, 0.9), 0 0 4px rgba(4, 5, 15, 0.7); }
.invite::before { content: ''; flex: none; width: 6px; height: 6px; border-radius: 50%; background: #fff; box-shadow: 0 0 10px 2px var(--amber); animation: twinkle 3.2s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: 0.35; box-shadow: 0 0 4px 1px var(--amber); } }

/* apps */
.apps { list-style: none; margin: 26px 0 0; padding: 0; display: grid; gap: 12px; }
.app { display: flex; gap: 16px; align-items: center; padding: 16px 18px; border-radius: 6px; border: 1px solid var(--line); background: var(--plate); transition: border-color 0.4s, background 0.4s; }
.app.lit { border-color: rgba(236, 203, 147, 0.7); background: rgba(14, 13, 28, 0.84); }
.app.lit .icon { box-shadow: 0 0 28px rgba(255, 180, 100, 0.45); }
.app .icon { flex: none; width: 52px; height: 52px; border-radius: 14px; background: radial-gradient(circle at 32% 30%, #ffe7bf, #c98a4f 55%, #2a1a44); box-shadow: 0 0 24px rgba(255, 180, 100, 0.35); }
/* a planet not yet lit: a thin crescent of starlight on its left */
.app[data-status="wip"] .icon { border-radius: 50%; background: radial-gradient(circle at 74% 62%, #0a0c1c 58%, #1a1e36 72%, #4b4a58 90%, #8d7f6b 100%); box-shadow: 0 0 0 1px rgba(236, 203, 147, 0.22); }
.app .txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.app .name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-weight: 700; color: var(--ink); line-height: 1.5; }
.chip { padding: 1px 8px; border: 1px solid var(--line); border-radius: 3px; font-size: 11.5px; font-weight: 700; line-height: 1.6; color: var(--amber); }
.app .desc { color: var(--text); font-size: 14.5px; line-height: 1.7; }
.app .meta { font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.1em; color: var(--muted); margin-top: 2px; }

/* about: the one place with no metaphors */
.facts { margin: 26px 0 0; padding: 6px 18px; border-radius: 6px; border: 1px solid var(--line); background: var(--plate); }
.facts div { display: grid; grid-template-columns: 70px 1fr; gap: 12px; padding: 8px 0; border-top: 1px solid rgba(236, 203, 147, 0.14); line-height: 1.65; }
.facts div:first-child { border-top: 0; }
.facts dt { font-size: 13px; font-weight: 700; color: var(--amber); padding-top: 2px; }
.facts dd { margin: 0; font-size: 15px; color: var(--ink); }
.facts a { color: var(--ink); text-decoration-color: var(--amber); }

/* contact */
.mail { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin: 26px 0 0; padding: 12px 12px 12px 18px; border-radius: 6px; border: 1px solid var(--line); background: var(--plate); font-family: var(--f-mono); font-size: 19px; }
.mail a { color: var(--ink); text-decoration-color: var(--amber); }
.copy { min-height: 44px; padding: 0 18px; border-radius: 4px; border: 1px solid var(--amber); background: transparent; color: var(--amber); font-family: var(--f-body); font-size: 14px; font-weight: 700; cursor: pointer; transition: background 0.2s, color 0.2s; }
.copy:hover { background: var(--amber); color: #1a1204; }

/* ---- footer ---- */
.foot { position: relative; z-index: 1; padding: 0 var(--edge) calc(var(--dock-h) + 52px); color: var(--text); font-size: 14px; }
.foot .in { max-width: var(--col); display: grid; gap: 8px; padding-top: 26px; border-top: 1px solid var(--line); }
.brandline { margin: 0; font-size: 13px; letter-spacing: 0.08em; }
.brand-sm { font-family: var(--f-logo); font-weight: 600; font-size: 14px; letter-spacing: 0.34em; color: var(--ink); }
.footnav { display: flex; flex-wrap: wrap; gap: 0 22px; }
.footnav a { color: var(--text); min-height: 44px; display: inline-flex; align-items: center; text-shadow: 0 0 4px var(--bg), 0 0 2px var(--bg); }
.footnav a:hover { color: var(--ink); }
.copy-line { margin: 0; color: var(--text); font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.06em; text-shadow: 0 0 4px var(--bg), 0 0 2px var(--bg); }

/* ---- dock (always one tap) ---- */
.dock {
  position: fixed; z-index: 6; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  display: flex; gap: 2px; padding: 5px; border-radius: 10px;
  background: var(--glass); border: 1px solid var(--line);
  max-width: calc(100vw - 16px);
}
.dock a { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 6px; color: var(--ink); text-decoration: none; font-size: 12.5px; letter-spacing: 0.14em; font-weight: 700; white-space: nowrap; transition: background 0.4s; }
.dock a::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, 0.35); transition: 0.4s; }
.dock a:hover { background: rgba(255, 255, 255, 0.07); }
.dock a.on { background: rgba(236, 203, 147, 0.14); }
.dock a.on::before { background: var(--amber); box-shadow: 0 0 10px var(--amber); }

/* ---- lab dialog (hidden star) ---- */
dialog.lab { border: 1px solid var(--line); border-radius: 8px; background: #090b1c; color: var(--text); padding: 28px 24px 22px; width: min(520px, calc(100% - 24px)); margin: auto auto 12px; }
dialog.lab::backdrop { background: rgba(2, 3, 10, 0.62); }
dialog.lab .eyebrow { margin-bottom: 10px; }
dialog.lab h2 { font-size: clamp(25px, 6vw, 32px); }
dialog.lab p:not(.eyebrow) { margin: 14px 0 0; }
dialog.lab .close { margin-top: 22px; min-height: 48px; padding: 0 24px; border: 0; border-radius: 4px; background: var(--amber); color: #1a1204; font-family: var(--f-body); font-size: 15px; font-weight: 700; cursor: pointer; }

/* ---- toast ---- */
.toast { position: fixed; z-index: 7; left: 50%; bottom: calc(var(--dock-h) + 24px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 6px); width: max-content; max-width: calc(100vw - 32px); padding: 9px 16px; border-radius: 6px; border: 1px solid var(--line); background: #090b1c; color: var(--ink); font-size: 13.5px; line-height: 1.5; text-align: center; opacity: 0; pointer-events: none; transition: opacity 0.4s, transform 0.4s; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---- documents: privacy policy, 404 ---- */
.docpage .top { background: var(--bg); padding-bottom: 14px; }
.doc .in { max-width: 720px; margin: 0 auto; padding: 104px var(--edge) 150px; }
.doc h1, .doc h2, .doc h3 { font-family: var(--f-body); font-weight: 700; }  /* documents use the plain sans, not the playful display face */
.doc h1 { font-size: clamp(28px, 6.4vw, 38px); margin: 0 0 12px; line-height: 1.3; animation: none; }
.doc h2 { font-size: 22px; margin: 44px 0 12px; line-height: 1.45; }
.doc h3 { font-size: 16px; margin: 26px 0 8px; line-height: 1.5; color: var(--ink); }
.doc p, .doc li { line-height: 1.95; word-break: normal; text-wrap: wrap; }  /* long reading fills the measure; phrase breaks are for short copy */
.doc p { margin: 0 0 14px; }
.doc ul { margin: 0 0 14px; padding-left: 1.4em; }
.doc li { margin-bottom: 6px; }
.doc a { color: var(--ink); text-decoration-color: var(--amber); }
.doc .dates { font-size: 14px; color: var(--muted); }
.doc-foot { padding-left: 0; padding-right: 0; }
.doc-foot .in { max-width: 720px; margin: 0 auto; padding-left: var(--edge); padding-right: var(--edge); border-top: 0; }

/* ---- wide screens ---- */
@media (min-width: 900px) {
  :root { --edge: clamp(48px, 9vw, 168px); }
  body { font-size: 17px; }
  .lead { font-size: 18px; }
  .note { font-size: 14.5px; }
  .invite { font-size: 15px; }
  .star .in { padding-top: 110px; padding-bottom: calc(var(--dock-h) + 64px); }
  /* the hero sits in the middle of a wide screen; only phones lift the sky above the words */
  #top { align-items: center; }
  .star .in::before { left: 0; right: auto; width: calc(var(--edge) + var(--col) + 160px); background: radial-gradient(ellipse 64% 64% at 56% 50%, rgba(4, 5, 15, 0.78), rgba(4, 5, 15, 0.46) 45%, rgba(4, 5, 15, 0) 72%); }
  .facts div { grid-template-columns: 96px 1fr; }
  .facts dt { font-size: 14px; padding-top: 1px; }
  .facts dd, .app .desc { font-size: 16px; }
  .mail { font-size: 22px; }
  dialog.lab { margin: auto; }
  .doc .in { padding-top: 120px; }
  /* policy pages: heading on the left, text on the right (uses the width, reads like a formal document) */
  .doc .in { max-width: 1180px; display: grid; grid-template-columns: minmax(190px, 260px) minmax(0, 1fr); column-gap: clamp(40px, 5vw, 80px); align-content: start; }
  .doc .in > * { grid-column: 2; max-width: 46em; }
  .doc .in > h1, .doc .in > .dates, .doc .in > .note-en { grid-column: 1 / -1; max-width: none; }
  .doc .in > h2 { grid-column: 1; margin: 0; padding-top: 34px; font-size: 18px; max-width: none; }
  .doc .in > h2 + * { padding-top: 34px; margin-top: 0; }
  .doc .in > h2 + p, .doc .in > h2 + ul { border-top: 0; }
  .doc-foot .in { max-width: 1180px; padding-left: var(--edge); padding-right: var(--edge); }
}

/* ---- reduced motion: a quiet sky and a plain page ---- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  h1, h2, .hint, .toast, .dock a, .copy { transition: none; }
  h1, .hint .arrow, .invite::before { animation: none; }
  .dust-pending h2 { opacity: 1; }
}
