/* ==========================================================
   HonsaN Studio
   すべてを「ブロック」ひとつの単位で組み立てるデザインシステム
   ========================================================== */

@layer reset, tokens, base, layout, components, pages, utilities;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  body, h1, h2, h3, p, dl, dd, ol, ul, figure { margin: 0; }
  ol, ul { padding: 0; }
  img, svg, canvas { display: block; max-width: 100%; }
  button { font: inherit; color: inherit; }
}

@layer tokens {
  :root {
    /* 色 */
    --ultra: #2a31d8;      /* ヒーローの盤面 */
    --ultra-deep: #1f25b4;
    --ink: #15183f;        /* 本文 */
    --soft: #5a5f86;       /* 補足 */
    --paper: #ffffff;
    --mist: #eef0fb;       /* 面の切り替え */
    --sun: #ffd23f;        /* 大文字の N */
    --key: #f4f5ff;        /* 白いブロック */
    --rule: #cfd3ee;

    /* 書体 */
    --f-display: "Dela Gothic One", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
    --f-body: "Zen Kaku Gothic New", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;

    /* 余白の単位 = ブロック1マス */
    --u: 8px;
    --gutter: clamp(20px, 5vw, 64px);
    --max: 1200px;
    --measure: 36em;

    --radius-block: 22%;
    --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  }
}

@layer base {
  html { scroll-behavior: smooth; }
  @media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

  body {
    background: var(--paper);
    color: var(--ink);
    font-family: var(--f-body);
    font-size: 1rem;
    line-height: 1.9;
    letter-spacing: 0.03em;
    font-feature-settings: "palt" 0;
    line-break: strict;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }

  ::selection { background: var(--sun); color: var(--ink); }

  a { color: inherit; }
  :focus-visible {
    outline: 3px solid var(--sun);
    outline-offset: 3px;
    border-radius: 6px;
  }
  .on-light :focus-visible, main :focus-visible { outline-color: var(--ultra); }

  p, li, dd { text-wrap: pretty; }
  h1, h2, h3 { font-weight: 400; line-height: 1.3; word-break: auto-phrase; text-wrap: balance; }
  .hero-lead, .mail-label, .kicker { word-break: auto-phrase; }
}

@layer layout {
  .wrap {
    width: 100%;
    max-width: calc(var(--max) + var(--gutter) * 2);
    margin-inline: auto;
    padding-inline: var(--gutter);
  }
  .section { padding-block: clamp(88px, 13vw, 176px); }
  .section + .section { padding-top: 0; }
}

@layer components {
  /* ---------- スキップリンク ---------- */
  .skip {
    position: fixed; left: 12px; top: -60px; z-index: 100;
    background: var(--sun); color: var(--ink);
    padding: 10px 16px; border-radius: 10px; font-weight: 700; text-decoration: none;
    transition: top 0.2s var(--ease-out);
  }
  .skip:focus { top: 12px; }

  /* ---------- ヘッダー ---------- */
  .site-header {
    position: fixed; inset: 0 0 auto; z-index: 50;
    color: #fff;
    transition: background-color 0.35s var(--ease-out), color 0.35s var(--ease-out), box-shadow 0.35s var(--ease-out);
  }
  .site-header .wrap {
    display: flex; align-items: center; justify-content: space-between;
    min-height: 72px; gap: 24px;
  }
  .site-header.is-light {
    background: rgb(255 255 255 / 0.86);
    -webkit-backdrop-filter: saturate(1.4) blur(14px);
    backdrop-filter: saturate(1.4) blur(14px);
    color: var(--ink);
    box-shadow: 0 1px 0 var(--rule);
  }
  .site-header.is-static { position: sticky; top: 0; background: var(--ultra); }

  .brand {
    display: inline-flex; align-items: center; gap: 12px;
    text-decoration: none; font-family: var(--f-display);
    font-size: 1.02rem; letter-spacing: 0.04em; line-height: 1;
  }
  .brand-mark { width: 26px; height: 26px; flex: none; }
  .brand-mark rect { fill: currentColor; }
  .brand-mark .n { fill: var(--sun); }

  .nav { display: flex; gap: clamp(16px, 3vw, 36px); list-style: none; }
  .nav a {
    position: relative; display: inline-block; padding-block: 10px;
    font-size: 0.92rem; font-weight: 700; text-decoration: none; letter-spacing: 0.06em;
  }
  /* ブロックが並んで下線になる */
  .nav a::after, .link-blocks::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 4px; height: 4px;
    background-image: linear-gradient(90deg, currentColor 4px, transparent 4px);
    background-size: 7px 4px;
    clip-path: inset(0 100% 0 0);
    transition: clip-path 0.42s steps(8, end);
  }
  .nav a:hover::after, .nav a:focus-visible::after,
  .link-blocks:hover::after, .link-blocks:focus-visible::after { clip-path: inset(0 0 0 0); }

  @media (max-width: 720px) {
    .nav li:not(:last-child) { display: none; }
  }

  /* ---------- 点線（小さな正方形の並び） ---------- */
  .dots {
    height: 6px; border: 0; margin: 0;
    background-image: linear-gradient(90deg, transparent 3px, var(--rule) 3px 9px, transparent 9px);
    background-size: 12px 6px; background-repeat: space no-repeat;
  }

  /* ---------- セクション見出し ---------- */
  .kicker {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: clamp(28px, 4vw, 48px);
    font-size: 0.95rem; font-weight: 700; letter-spacing: 0.08em; color: var(--ultra);
  }
  .kicker::before {
    content: ""; width: 14px; height: 14px; border-radius: 3px;
    background: var(--ultra);
    box-shadow: inset 0 -3px 0 rgb(0 0 0 / 0.22);
  }

  /* ---------- ピクセルのアイコン ---------- */
  .pix { display: block; width: 64px; height: 64px; }
  .pix rect { fill: var(--ultra); }

  /* ---------- 情報一覧 ---------- */
  .facts > div {
    display: grid; grid-template-columns: minmax(8em, 13em) 1fr; gap: 8px 24px;
    padding-block: 22px;
    background-image: linear-gradient(90deg, transparent 2px, var(--rule) 2px 6px, transparent 6px);
    background-size: 8px 2px; background-repeat: space no-repeat; background-position: 0 100%;
  }
  .facts > div:first-child { padding-top: 0; }
  .facts dt { font-weight: 700; }
  .facts dd { overflow-wrap: anywhere; word-break: auto-phrase; }
  @media (max-width: 640px) {
    .facts > div { grid-template-columns: 1fr; gap: 2px; padding-block: 18px; }
  }

  /* ---------- フッター ---------- */
  .site-footer {
    background: var(--ultra); color: #fff;
    padding-block: clamp(56px, 8vw, 96px) 40px;
  }
  .site-footer .wrap { display: grid; gap: 48px; }
  .foot-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 32px; }
  .foot-mark { width: min(420px, 72vw); height: auto; }
  .foot-mark rect { fill: var(--key); }
  .foot-mark .n { fill: var(--sun); }
  .foot-mark rect { transform-box: fill-box; transition: transform 0.5s cubic-bezier(0.3, 1.8, 0.4, 1); }
  .foot-mark rect:hover { transform: translateY(-40%); transition-duration: 0.12s; }
  @media (prefers-reduced-motion: reduce) { .foot-mark rect { transition: none; } .foot-mark rect:hover { transform: none; } }
  .foot-links { display: flex; flex-wrap: wrap; gap: 8px 28px; list-style: none; font-size: 0.92rem; }
  .foot-links a { position: relative; display: inline-block; padding-block: 8px; text-decoration: none; }
  @media (max-width: 640px) { .foot-links { flex-direction: column; gap: 0; } }
  .foot-copy { font-size: 0.82rem; color: rgb(255 255 255 / 0.72); letter-spacing: 0.06em; }
}

@layer pages {
  /* ======================================================
     トップページ
     ====================================================== */

  /* ---------- ヒーロー（触れる盤面） ---------- */
  .hero {
    position: relative;
    min-height: max(600px, 100svh);
    background: var(--ultra);
    color: #fff;
    overflow: hidden;
    touch-action: pan-y;
    isolation: isolate;
  }
  .hero-canvas {
    position: absolute; inset: 0; width: 100%; height: 100%;
    cursor: grab;
  }
  .hero-canvas.is-grabbing { cursor: grabbing; }
  .hero-canvas:focus-visible { outline: 3px solid var(--sun); outline-offset: -10px; border-radius: 20px; }

  /* JSが動かないときの見出し */
  .hero-title {
    position: absolute; inset: 0; display: grid; place-items: center;
    padding: var(--gutter);
    font-family: var(--f-display);
    font-size: clamp(3rem, 12vw, 10rem);
    letter-spacing: 0.01em; line-height: 1; text-align: center;
    pointer-events: none;
  }
  .js .hero-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; padding: 0; }

  .hero-bar {
    position: absolute; inset: auto 0 0; z-index: 2;
    pointer-events: none;
  }
  .hero-bar .wrap {
    display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 24px;
    padding-bottom: clamp(24px, 4vw, 44px);
  }
  .hero-lead {
    max-width: 22em;
    font-size: clamp(1rem, 1.6vw, 1.2rem); font-weight: 700; line-height: 1.75;
  }
  .hero-hint { margin-top: 6px; font-size: 0.85rem; color: rgb(255 255 255 / 0.74); }
  .hero-hint .touch { display: none; }
  @media (pointer: coarse) { .hero-hint .touch { display: inline; } .hero-hint .mouse { display: none; } }
  .no-js .hero-hint { display: none; }

  .hero-tools { display: flex; align-items: center; gap: 16px; pointer-events: auto; }
  .counter {
    display: flex; flex-direction: column; align-items: flex-end;
    font-size: 0.78rem; letter-spacing: 0.08em; color: rgb(255 255 255 / 0.74);
  }
  .counter output {
    font-family: var(--f-display); font-size: 1.6rem; line-height: 1.1; color: #fff;
    font-variant-numeric: tabular-nums; letter-spacing: 0.02em;
  }
  .btn-reset {
    display: inline-flex; align-items: center; gap: 10px;
    min-height: 44px; padding: 0 18px;
    border: 2px solid #fff; border-radius: 12px;
    background: transparent; color: #fff; font-weight: 700; font-size: 0.88rem;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, opacity 0.3s var(--ease-out), transform 0.3s var(--ease-out);
  }
  .btn-reset:hover { background: #fff; color: var(--ultra); }
  .btn-reset[hidden] { display: inline-flex; opacity: 0; transform: translateY(8px); pointer-events: none; visibility: hidden; }
  .btn-reset svg { width: 14px; height: 14px; }
  .no-js .hero-tools { display: none; }

  @media (max-width: 640px) {
    .hero-bar .wrap { grid-template-columns: 1fr; gap: 18px; }
    .hero-tools { justify-content: space-between; }
    .counter { align-items: flex-start; order: -1; }
  }

  /* ---------- ステートメント ---------- */
  .statement h2 {
    font-family: var(--f-display);
    font-size: clamp(2.3rem, 7.4vw, 6.4rem);
    line-height: 1.22; letter-spacing: 0.01em;
  }
  .statement h2 .line { display: block; width: fit-content; }
  .statement-body {
    display: grid; grid-template-columns: repeat(12, 1fr); gap: 24px;
    margin-top: clamp(48px, 7vw, 96px);
  }
  .statement-body p {
    grid-column: 6 / span 6;
    font-size: clamp(1.02rem, 1.4vw, 1.14rem); line-height: 2.05;
    max-width: var(--measure);
  }
  @media (max-width: 860px) { .statement-body p { grid-column: 1 / -1; } }

  /* 行ごとのブロックワイプ（1回だけ） */
  .reveal .line { position: relative; }
  .js .reveal .line { color: transparent; transition: color 0s linear 0.42s; }
  .js .reveal .line::after {
    content: ""; position: absolute; inset: 0.06em 0 0.1em; border-radius: 0.08em;
    background: var(--ultra);
    transform: scaleX(0); transform-origin: left;
  }
  .js .reveal.is-in .line { color: var(--ink); }
  .js .reveal.is-in .line::after { animation: wipe 0.84s var(--ease-out) both; }
  .js .reveal.is-in .line:nth-child(2) { transition-delay: 0.54s; }
  .js .reveal.is-in .line:nth-child(2)::after { animation-delay: 0.12s; }
  .js .reveal.is-in .line:nth-child(3) { transition-delay: 0.66s; }
  .js .reveal.is-in .line:nth-child(3)::after { animation-delay: 0.24s; }
  @keyframes wipe {
    0%   { transform: scaleX(0); transform-origin: left; }
    50%  { transform: scaleX(1); transform-origin: left; }
    50.1%{ transform: scaleX(1); transform-origin: right; }
    100% { transform: scaleX(0); transform-origin: right; }
  }
  @media (prefers-reduced-motion: reduce) {
    .js .reveal .line { color: var(--ink); transition: none; }
    .js .reveal .line::after { display: none; }
  }

  /* ---------- つくり方（3つの約束） ---------- */
  .principles { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(32px, 4vw, 64px); }
  .principles li { display: grid; align-content: start; gap: 20px; padding-top: 28px; position: relative; }
  .principles li::before {
    content: ""; position: absolute; inset: 0 0 auto; height: 6px;
    background-image: linear-gradient(90deg, transparent 3px, var(--rule) 3px 9px, transparent 9px);
    background-size: 12px 6px; background-repeat: space no-repeat;
  }
  .principles h3 { font-family: var(--f-display); font-size: clamp(1.4rem, 2.2vw, 1.8rem); line-height: 1.35; }
  .principles p { color: var(--soft); line-height: 1.95; }
  .principles .pix { margin-bottom: 4px; }
  @media (max-width: 860px) { .principles { grid-template-columns: 1fr; gap: 40px; } }

  /* ---------- 開発中：スマホの中でブロックが積み上がる ---------- */
  .now {
    position: relative; overflow: hidden;
    background: var(--mist);
    border-radius: clamp(20px, 3vw, 36px);
    padding: clamp(40px, 6vw, 88px) clamp(28px, 6vw, 88px) 0;
    display: grid; grid-template-columns: 1.25fr 1fr; gap: 40px; align-items: end;
  }
  .now-text { padding-bottom: clamp(40px, 6vw, 88px); }
  .now h2 { font-family: var(--f-display); font-size: clamp(2rem, 4.6vw, 3.8rem); line-height: 1.2; }
  .now p { margin-top: 24px; color: var(--soft); max-width: 26em; }

  .phone {
    justify-self: center; position: relative;
    width: clamp(220px, 23vw, 288px); aspect-ratio: 9 / 16.5;
    padding: 12px 12px 0;
    background: var(--ink);
    border-radius: 42px 42px 0 0;
    box-shadow: 0 30px 60px -20px rgb(21 24 63 / 0.35);
  }
  .screen {
    position: relative; height: 100%; overflow: hidden;
    container-type: inline-size;
    border-radius: 31px 31px 0 0;
    background: var(--ultra);
  }
  .screen::before {                 /* 画面上部のカメラ */
    content: ""; position: absolute; top: 12px; left: 50%; translate: -50% 0;
    width: 30%; height: 20px; border-radius: 20px; background: var(--ink); z-index: 2;
  }
  .screen-hud {
    position: absolute; z-index: 2; top: 46px; inset-inline: 8cqw;
    display: flex; justify-content: space-between; align-items: center;
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; color: rgb(255 255 255 / 0.8);
  }
  .screen-hud b { display: inline-flex; align-items: center; gap: 6px; color: #fff; }
  .screen-hud b::before {
    content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--sun);
    animation: blink 1.2s steps(2, jump-none) infinite;
  }
  @keyframes blink { 50% { opacity: 0.2; } }

  .stack {
    position: absolute; left: 8cqw; bottom: 4cqw; width: 84cqw; height: 154cqw;
    overflow: hidden;
    /* 盤面のマス */
    background-image: conic-gradient(at 12cqw 12cqw, transparent 75%, rgb(255 255 255 / 0.06) 0);
    background-size: 14cqw 14cqw;
    background-position: 1cqw 1cqw;
  }
  .stack i {
    position: absolute; left: 0; bottom: 0; width: 12cqw; height: 12cqw;
    border-radius: 22%;
    background: var(--key);
    box-shadow: inset 0 -1.6cqw 0 rgb(20 22 90 / 0.18);
    transform: translate(calc(var(--c) * 14cqw + 1cqw), calc(var(--r) * -14cqw - 1cqw));
    transition: transform 0.36s cubic-bezier(0.55, 0, 1, 0.45);
  }
  .stack i.sun { background: var(--sun); }
  .stack i.clear { animation: pop 0.42s var(--ease-out) forwards; }
  @keyframes pop {
    0% { background: #fff; box-shadow: 0 0 0 0.6cqw #fff; }
    40% { background: var(--sun); scale: 1.08; }
    100% { scale: 0; opacity: 0; }
  }
  @media (prefers-reduced-motion: reduce) {
    .screen-hud b::before { animation: none; }
    .stack i { transition: none; }
  }
  @media (max-width: 860px) {
    .now { grid-template-columns: 1fr; gap: 8px; }
    .now-text { padding-bottom: 32px; }
  }

  /* ---------- スタジオ・お問い合わせ ---------- */
  .split { display: grid; grid-template-columns: 4fr 8fr; gap: clamp(32px, 5vw, 80px); }
  .split > h2 {
    font-family: var(--f-display); font-size: clamp(1.8rem, 3.4vw, 2.8rem); line-height: 1.25;
  }
  @media (max-width: 860px) { .split { grid-template-columns: 1fr; } }

  .mails { display: grid; gap: clamp(28px, 4vw, 44px); }
  .mail-label { font-size: 0.92rem; color: var(--soft); margin-bottom: 4px; }
  .mail {
    position: relative; display: inline-block;
    font-family: var(--f-display); font-size: clamp(1.25rem, 3.6vw, 2.6rem); line-height: 1.3;
    letter-spacing: 0.01em; text-decoration: none; overflow-wrap: anywhere;
    padding-bottom: 12px;
  }
  .mail::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 6px;
    background-image: linear-gradient(90deg, var(--ultra) 6px, transparent 6px);
    background-size: 10px 6px;
    clip-path: inset(0 calc(100% - 30px) 0 0);
    transition: clip-path 0.5s steps(14, end);
  }
  .mail:hover::after, .mail:focus-visible::after { clip-path: inset(0 0 0 0); }
  .mail-note { margin-top: 8px; font-size: 0.9rem; color: var(--soft); }

  /* ======================================================
     規約ページ
     ====================================================== */
  .doc { padding-block: clamp(56px, 8vw, 104px) clamp(88px, 10vw, 140px); }
  .doc .wrap { max-width: calc(46rem + var(--gutter) * 2); }
  .doc h1 { font-family: var(--f-display); font-size: clamp(1.8rem, 4.4vw, 2.8rem); line-height: 1.3; }
  .doc .updated { margin: 12px 0 clamp(40px, 6vw, 64px); font-size: 0.9rem; color: var(--soft); }
  .doc h2 {
    display: flex; align-items: baseline; gap: 12px;
    margin: 56px 0 16px; font-size: 1.12rem; font-weight: 700; line-height: 1.6;
  }
  .doc h2::before {
    content: ""; flex: none; width: 12px; height: 12px; border-radius: 3px; background: var(--ultra);
    transform: translateY(-1px);
  }
  .doc p { margin-bottom: 16px; }
  .doc ol { padding-left: 1.5em; margin-bottom: 16px; }
  .doc li + li { margin-top: 8px; }
  .doc .facts { margin-top: 8px; }
  .doc .facts + p { margin-top: 28px; }
  .doc .note { color: var(--soft); font-size: 0.92rem; }
  .doc a { color: var(--ultra); text-underline-offset: 0.22em; }

  /* ---------- 404 ---------- */
  .lost { min-height: 70svh; display: grid; align-content: center; gap: 24px; }
  .lost .pix { width: 96px; height: 96px; }
}

@layer utilities {
  .sr-only {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip-path: inset(50%); white-space: nowrap;
  }
}
