/* モノクロの中央軸。余白は要素のまとまりごとに揃える。 */
@font-face {
  font-family: "Instrument Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/instrument-serif.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Shippori Mincho";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/shippori-mincho-medium-site.woff2?v=copy-1") format("woff2");
}
:root {
  /* 8pxを基準とする配置グリッド。UI固有の線幅・活字サイズは別管理。 */
  --unit: 8px;
  --space-1: var(--unit);
  --space-2: calc(var(--unit) * 2);
  --space-3: calc(var(--unit) * 3);
  --space-4: calc(var(--unit) * 4);
  --space-6: calc(var(--unit) * 6);
  --space-8: calc(var(--unit) * 8);
  /* 高さ880pxを超える余白を8区画へ配分。グループ内の8px基準は保持。 */
  --layout-slack: clamp(0px, calc((100svh - 880px) / 8), 64px);
  --group-gap: max(var(--space-1), var(--layout-slack));
  --icon-gap: var(--space-2);
  /* 導入組を4単位下げ、組間の空間から移す。組内の距離は固定。 */
  --intro-inset: calc(var(--space-6) + var(--layout-slack));
  --footer-gap: var(--space-8);
  /* 同じ意味の階層は同じ活字サイズを共有する。 */
  --type-heading: 32px;
  --type-body: 20px;
  --type-note: 14px;
  --radius-ui: 12px;
  --radius-button: 4px;
  color-scheme: light;
  background: #fff;
  color: #181818;
  font-family: "Instrument Serif", "Shippori Mincho", "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-synthesis: none;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
  font-kerning: normal;
}
* { box-sizing: border-box; }
::selection { background-color: rgb(0, 47, 244); color: #fff; }
/* 行枠は保ち、選択中だけ実字形の上下へ描画範囲を絞る。 */
.selection-baseline { display: inline-block; width: 0; height: 0; padding: 0; border: 0; vertical-align: baseline; }
.selection-ink-active { clip-path: inset(var(--selection-top) -100vw var(--selection-bottom) -100vw); }
body { margin: 0; }
p, figure { margin: 0; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 5px; }
a:hover { text-decoration: none; }
a:focus-visible { outline: 1px solid currentColor; outline-offset: 6px; }
.page {
  width: min(100%, 1280px); min-height: 100svh; margin-inline: auto;
  padding: var(--space-6) var(--space-4) var(--space-2);
  display: grid; grid-template-rows: 1fr auto; row-gap: var(--footer-gap);
  text-align: center;
}
/* 見出しの実際の文字幅を列幅にする。デモ側から列幅を押し広げない。 */
main { width: max-content; max-width: 100%; justify-self: center; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(min-content, 1fr); justify-items: center; gap: var(--group-gap); align-self: stretch; min-width: 0; }
.intro { padding-top: var(--intro-inset); display: grid; justify-items: center; align-content: start; gap: var(--icon-gap); width: 100%; }
.wordmark { display: grid; gap: var(--space-2); width: 100%; }
.app-icon, .icon-placeholder { display: block; width: calc(var(--unit) * 10); height: calc(var(--unit) * 10); border-radius: 22%; }
.app-icon { object-fit: contain; transform: translateY(calc(-1 * var(--unit))); }
.icon-placeholder { display: grid; place-items: center; border: 1px solid #dedede; color: #444; font-size: 12px; }
h1 { white-space: nowrap; margin: 0; font-size: clamp(44px, min(16vw, 15svh), 172px); font-weight: 400; line-height: .98; letter-spacing: -.012em; }
/* 実テキストで列幅と読み上げを保持し、字間調整した輪郭を同じ行枠へ描く。 */
h1 { position: relative; }
.wordmark-art { display: none; }
h1:has(> .wordmark-art) { color: transparent; }
/* 可視ロゴはSVG側で選択文字だけ白にする。元テキストを重ねて描かない。 */
h1:has(> .wordmark-art)::selection { color: transparent; }
h1:has(> .wordmark-art) > .wordmark-art { display: block; position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
:root[data-debug-font="libre-caslon"] h1 { color: #181818; }
:root[data-debug-font="libre-caslon"] h1::selection { color: #fff; }
:root[data-debug-font="libre-caslon"] h1 > .wordmark-art { display: none; }
@media print { h1:has(> .wordmark-art) { color: #181818; } h1:has(> .wordmark-art) > .wordmark-art { display: none; } }
.tagline { font-size: var(--type-heading); line-height: var(--space-4); }
.experience { display: grid; align-self: center; justify-items: center; gap: var(--space-6); width: 100%; min-width: 0; }
.visual { width: 96%; min-width: 0; }
.download-area { display: grid; justify-items: center; gap: var(--space-2); width: 100%; }
.actions { display: grid; gap: var(--space-2); }
.action {
  display: flex; align-items: center; justify-content: center;
  width: calc(var(--unit) * 26); min-height: var(--space-6); padding: var(--space-1) var(--space-3);
  border: 1px solid #181818; border-radius: var(--radius-button);
  font: inherit; font-size: var(--type-body); line-height: 24px; text-decoration: none;
}
.download { background: #181818; color: #fff; }
.source { background: #fff; color: #181818; border-color: #999; }
a.download:hover { background: #333; }
a.source:hover { border-color: #181818; }
.action:disabled { cursor: default; opacity: 1; -webkit-text-fill-color: currentColor; }
.requirements { color: #444; font-size: var(--type-note); line-height: var(--space-3); }
footer { display: grid; justify-items: center; gap: var(--space-2); color: #181818; }
.signature { --creator-tracking: 0px; --creator-offset-x: 0px; --creator-offset-y: -6px; display: grid; grid-template-rows: calc(var(--unit) * 5) var(--space-3); justify-items: center; gap: var(--space-1); }
.organization { font-size: var(--type-heading); line-height: calc(var(--unit) * 5); letter-spacing: -.012em; }
.organization a { position: relative; display: inline-block; text-decoration: none; }
.signature-name { display: inline-block; transform: translateY(2px); }
.organization a::after {
  content: ""; position: absolute; inset-inline: 0; bottom: 0;
  height: .5px; background: currentColor; transform: scaleX(0); transform-origin: center;
  transition: transform 600ms cubic-bezier(.22, 1, .36, 1);
}
.organization a:hover::after, .organization a:focus-visible::after { transform: scaleX(1); }
.creator { font-size: var(--type-body); line-height: var(--space-3); white-space: nowrap; transform: translate(var(--creator-offset-x), var(--creator-offset-y)); }
.signature-copy { letter-spacing: var(--creator-tracking); }
.signature-baseline { display: inline-block; width: 0; height: 0; vertical-align: baseline; }
.legal { font-size: var(--type-note); line-height: var(--space-2); }
.skip { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.skip:focus { width: auto; height: auto; clip-path: none; top: var(--space-2); left: var(--space-2); }
@media (prefers-reduced-motion: reduce) { .signature-name { display: inline-block; transform: translateY(2px); }
.organization a::after { transition: none; } }

/* デモ内の活字・メニューバーはmacOSの寸法。配置余白は8pxグリッド。 */
.counter-demo {
  --demo-selection-background: #b4d7ff;
  overflow: hidden; border: 1px solid rgb(0 0 0 / .12); border-radius: var(--radius-ui);
  background: #fff; color: #202020; text-align: left;
  box-shadow: 0 4px 16px rgb(0 0 0 / .035);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Hiragino Kaku Gothic ProN", sans-serif;
  font-weight: 400; font-size: 13px; line-height: 1; font-synthesis: weight;
}
/* デモ内の実選択と疑似選択はmacOS風の同じ色を使う。 */
.counter-demo::selection, .counter-demo ::selection {
  background-color: var(--demo-selection-background); color: #202020;
}
.mac-menubar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-2);
  height: 28px; padding-inline: var(--space-2); background: linear-gradient(#f5f5f5, #ededed);
  border-bottom: 1px solid rgb(0 0 0 / .06); white-space: nowrap; user-select: none;
}
.mac-menus, .mac-status { display: flex; align-items: center; }
.mac-apple { width: 13px; height: 16px; fill: currentColor; }
/* 計数と時計は同じ活字・行枠で基線を揃える。小数サイズだけ別指定しない。 */
.mac-status { gap: 13px; flex-shrink: 0; font-size: 12px; font-weight: 500; line-height: 16px; }
#demo-count { min-width: 12px; text-align: center; font-variant-numeric: tabular-nums; }
.mac-status img { display: block; flex-shrink: 0; object-fit: contain; }
.mac-wifi { width: 17px; height: 13px; }
.mac-battery { width: 22px; height: 11px; }
.mac-controls { width: 16px; height: 14px; }
.demo-editor { position: relative; }
#demo-text, .demo-typing {
  display: block; width: 100%; min-width: 0;
  height: calc(var(--space-3) * 3 + var(--space-2) * 2); margin: 0;
  padding: var(--space-2) var(--space-3); border: 0; border-radius: 0; background: transparent; color: #202020;
  font: inherit; font-size: 16px; line-height: var(--space-3); resize: none;
  outline: none; overflow: auto; caret-color: currentColor; scrollbar-gutter: stable;
  white-space: pre-wrap; overflow-wrap: break-word;
  scrollbar-width: thin; scrollbar-color: rgb(32 32 32 / .28) transparent;
}
#demo-text::-webkit-scrollbar, .demo-typing::-webkit-scrollbar { width: var(--space-1); height: var(--space-1); background: transparent; }
#demo-text::-webkit-scrollbar-track, #demo-text::-webkit-scrollbar-corner,
.demo-typing::-webkit-scrollbar-track, .demo-typing::-webkit-scrollbar-corner { background: transparent; }
#demo-text::-webkit-scrollbar-thumb { background: rgb(32 32 32 / .28); border-radius: var(--space-1); }
.demo-typing::-webkit-scrollbar-thumb { background: transparent; }
.demo-typing {
  position: absolute; inset: 0; pointer-events: none; color: transparent;
  scrollbar-color: transparent transparent;
}
.demo-typing[hidden] { display: none; }
.demo-caret {
  display: inline-block; position: relative; width: 0; height: 1.25em;
  vertical-align: -.25em; animation: demo-caret-blink 1.1s steps(1) infinite;
}
.demo-caret::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 1px; background: #202020; }
/* 入力・Backspace中は、通常の入力カーソル同様に消灯させない。 */
.demo-typing[data-phase="typing"] .demo-caret,
.demo-typing[data-phase="deleting"] .demo-caret { animation: none; opacity: 1; }
/* 変換中は読みを下線で表示。選択時だけ鏡側へ文字を描いて青い選択の上へ置く。 */
#demo-text[data-presenting="true"] { caret-color: transparent; }
.demo-composition { color: #202020; text-decoration: underline; text-underline-offset: 3px; }
.demo-typing-text, .demo-composition { position: relative; z-index: 1; }
.demo-selection { position: absolute; inset: 0; pointer-events: none; }
.demo-selection-line { position: absolute; background: var(--demo-selection-background); }
.demo-typing:is([data-phase="selecting"], [data-phase="copy-wait"], [data-phase="copied"]) { color: #202020; }
.demo-typing:is([data-phase="selecting"], [data-phase="copy-wait"], [data-phase="copied"]) .demo-caret { visibility: hidden; }
.demo-pointer { position: absolute; z-index: 2; width: 7px; height: 18px; transform: translate(-50%, -50%); }
.demo-pointer::after { content: ""; position: absolute; inset: 0; border-block: 1px solid #202020; background: linear-gradient(90deg, transparent 3px, #202020 3px, #202020 4px, transparent 4px); filter: drop-shadow(0 0 1px #fff); }
.demo-pointer[hidden] { display: none; }
@keyframes demo-caret-blink { 0%, 55% { opacity: 1; } 56%, 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .demo-caret { animation: none; } }
#demo-text:disabled { opacity: 1; -webkit-text-fill-color: #202020; }
.demo-unavailable { padding: 0 var(--space-3) var(--space-2); color: #636363; font-size: 10px; line-height: var(--space-2); }
.demo-unavailable[hidden] { display: none; }

/* 800px高でも全要素を保持。短い画面は同じ単位で余白とアイコンを縮める。 */
@media (min-width: 800px) and (max-height: 999px) {
  .page { padding-block: var(--space-4) var(--space-2); row-gap: var(--space-6); }
  main { gap: var(--space-1); }
  .intro { --intro-inset: var(--space-3); }
  .app-icon, .icon-placeholder { width: calc(var(--unit) * 9); height: calc(var(--unit) * 9); }
  .experience { gap: calc(var(--unit) * 5); }
  .actions, .download-area { gap: var(--space-1); }
  .action { min-height: calc(var(--unit) * 5); padding-block: 0; }
}
/* 横向きの短画面では、列幅まで高さに連動して狭くしない。
   同じ中央一列・デモ96%・16pxの入力文字を保つ。 */
@media (min-width: 768px) and (max-height: 999px) and (orientation: landscape) {
  h1 { font-size: clamp(152px, min(16vw, 15svh), 172px); }
}
/* 620pxの可視高さを基準に、増えた高さを既存の組へ配分する。
   小さい画面でも本文・署名を隠さず、入力欄は通常どおりスクロールする。 */
@media (min-width: 768px) and (max-height: 880px) and (orientation: landscape) {
  .page {
    --landscape-space: clamp(0px, calc((100svh - 620px) / 8), 32px);
    padding-top: var(--space-2);
    padding-bottom: max(var(--space-2), env(safe-area-inset-bottom));
    row-gap: calc(var(--space-1) + var(--landscape-space));
  }
  main { gap: var(--space-1); }
  .actions, .download-area { gap: var(--space-1); }
  .action { min-height: calc(var(--unit) * 5); padding-block: 0; }
  .intro { --intro-inset: var(--space-1); }
  .app-icon, .icon-placeholder {
    width: min(72px, calc(var(--space-4) + var(--landscape-space) * 4));
    height: min(72px, calc(var(--space-4) + var(--landscape-space) * 4));
  }
  .experience { gap: calc(var(--space-2) + var(--landscape-space)); }
  #demo-text, .demo-typing {
    height: min(104px, calc(48px + var(--landscape-space) * 2));
    padding-block: min(var(--space-2), calc(12px + var(--landscape-space) / 2));
  }
}
@media (max-width: 600px) {
  .page { padding-inline: var(--space-3); padding-bottom: var(--space-2); }
  main { gap: var(--space-1); }
  .intro { --intro-inset: var(--space-3); }
  .app-icon, .icon-placeholder { width: calc(var(--unit) * 9); height: calc(var(--unit) * 9); }
  h1 { font-size: clamp(44px, 14.5vw, 92px); }
  :root { --type-heading: 28px; }
  .mac-status { gap: var(--space-1); }
  .mac-battery, .mac-controls { display: none !important; }
  #demo-text, .demo-typing { padding-inline: var(--space-2); }
}

@media (min-width: 1440px) and (min-height: 1000px) {
  h1 { font-size: clamp(172px, min(15vw, 15svh), 224px); }
}

/* 背景だけを独立させ、文字・リンクの操作と既存の寸法を保つ。 */
body { isolation: isolate; background: #000; }
body::before, body::after, .atmosphere {
  content: ""; position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: 0; pointer-events: none;
}
body::before {
  background:
    radial-gradient(ellipse 52% 42% at 20% 28%, rgb(255 255 255 / .35) 0%, transparent 78%),
    radial-gradient(ellipse 42% 65% at 80% 68%, rgb(255 255 255 / .30) 0%, transparent 78%),
    radial-gradient(ellipse 65% 36% at 65% 8%, rgb(255 255 255 / .20) 0%, transparent 78%),
    linear-gradient(rgb(255 255 255 / .725), rgb(255 255 255 / .725));
  background-size: 140% 140%; background-repeat: no-repeat;
  background-position: var(--atmosphere-position, 0% 25%, 100% 75%, 20% 0%);
}
body::after {
  opacity: .04; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.atmosphere { display: block; }
/* ツールバーの伸縮に追従させず、画面回転・実際のサイズ変更だけで描画寸法を変える。 */
body::before, body::after, .atmosphere { height: 100vh; height: 100lvh; }
.atmosphere-active:not(.atmosphere-ready) body::before { animation: atmosphere-drift 48s ease-in-out infinite alternate; animation-delay: var(--atmosphere-delay, 0s); }
.atmosphere-active:not(.atmosphere-ready) body::after { animation: atmosphere-grain 1s steps(1, end) infinite; }
.atmosphere-paused body::before, .atmosphere-paused body::after { animation-play-state: paused !important; }
/* SVG粒子の露出を保ち、12個の位置を1秒で切り替える。 */
@keyframes atmosphere-grain {
  0%, 100% { background-position: 0 0; }
  8.333% { background-position: -37px 61px; }
  16.667% { background-position: 83px -29px; }
  25% { background-position: -71px -101px; }
  33.333% { background-position: 113px 47px; }
  41.667% { background-position: -19px 137px; }
  50% { background-position: 59px -83px; }
  58.333% { background-position: -127px 23px; }
  66.667% { background-position: 31px 109px; }
  75% { background-position: -97px -43px; }
  83.333% { background-position: 149px -67px; }
  91.667% { background-position: -53px 89px; }
}
@keyframes atmosphere-drift {
  from { background-position: 0% 25%, 100% 75%, 20% 0%; }
  to { background-position: 100% 75%, 0% 25%, 80% 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .atmosphere-active:not(.atmosphere-ready) body::before,
  .atmosphere-active:not(.atmosphere-ready) body::after { animation: none; }
}
.atmosphere-ready body::before, .atmosphere-ready body::after { opacity: 0; }
.page { position: relative; z-index: 1; }
.skip { z-index: 2; }

/* 右上の言語切替。中央の構成には余白・寸法の変更を加えない。 */
.language-switch {
  position: absolute; top: 20px; right: 26px; z-index: 2;
  display: flex; align-items: center; gap: 2px; font-size: var(--type-body); line-height: 1;
}
.language-switch[hidden] { display: none; }
.language-switch button {
  appearance: none; border: 0; background: none; color: #444444;
  font: inherit; min-width: 32px; min-height: 32px; padding: 4px 6px; cursor: pointer;
}
.language-switch button[aria-pressed="true"] {
  color: #181818; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px;
}
.language-switch button:hover { color: #181818; }
.language-switch button:focus-visible { outline: 1px solid currentColor; outline-offset: 2px; }
@media (max-width: 600px) { .language-switch { top: 12px; right: 14px; } }
