:root {
  --bg: #fafaf8;
  --text: #1c1c1a;
  --muted: #6b6b66;
  --line: #deded8;
  --faint: #b9b9b2;
  --ink: #d63c1c;
  --field: #ffffff;
  --accent: #1c1c1a;
  --accent-text: #fafaf8;
  --error: #b3261e;
  --ok: #1e6b3a;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141413;
    --text: #ecece6;
    --muted: #a0a099;
    --line: #33332f;
    --faint: #55554f;
  --ink: #ff6a48;
    --field: #1d1d1b;
    --accent: #ecece6;
    --accent-text: #141413;
    --error: #f2b8b5;
    --ok: #9ad4ae;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
  font-size: 16px;
  line-height: 1.8;
  -webkit-text-size-adjust: 100%;
}

.poster,
.page-head,
main,
footer {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 20px;
}

::selection {
  background: var(--text);
  color: var(--bg);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---- ファーストビュー ----
   社名 ZOQ と、その由来 /ZOQ over Qua(li|nti)ty/ を、1枚のポスターとして組む。
   Z・O・Q を縦に積み、それぞれの右に、その文字が表す語（ZOQ / over / Qua(li|nti)ty）を添える。
   ここに書くのは静止した完成形。動きは、下の prefers-reduced-motion: no-preference の中にだけある。 */

.hero {
  position: relative;
  overflow: hidden;
  overflow: clip;
}

/* 紙の粒子。画像ファイルを置かず、SVG のノイズを埋め込む */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  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='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.22;
  mix-blend-mode: multiply;
}

@media (prefers-color-scheme: dark) {
  .hero::after {
    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='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    opacity: 0.1;
    mix-blend-mode: screen;
  }
}

.poster {
  /* --g は Z・O・Q の文字の大きさ。幅と高さの両方に収まるほうを採る */
  --g: min(62vw, 30vh, 380px);
  --col: calc(var(--g) * 0.8);
  --gap: 16px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-top: 28px;
  padding-bottom: 24px;
}

@supports (height: 100svh) {
  .poster {
    --g: min(62vw, 30svh, 380px);
    min-height: 100svh;
  }
}

/* 四隅のトンボ */
.mark {
  position: absolute;
  width: 9px;
  height: 9px;
  border: 0 solid var(--muted);
}

.mark-tl { top: 9px; left: 9px; border-top-width: 1px; border-left-width: 1px; }
.mark-tr { top: 9px; right: 9px; border-top-width: 1px; border-right-width: 1px; }
.mark-bl { bottom: 9px; left: 9px; border-bottom-width: 1px; border-left-width: 1px; }
.mark-br { bottom: 9px; right: 9px; border-bottom-width: 1px; border-right-width: 1px; }

.rows {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* 1行 = 大きな1文字（左）と、その文字が表す語（右）。文字は下の罫線の上に座らせる */
.row {
  position: relative;
  flex: 1;
  display: grid;
  grid-template-columns: var(--col) minmax(0, 1fr);
  column-gap: var(--gap);
  align-items: end;
  min-height: calc(var(--g) * 0.86);
}

/* 行の上の罫線 */
.row::before,
.foot::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--text);
  transform-origin: left center;
}

/* 文字の列と語の列を分ける縦の罫線。3行ぶんがつながって1本に見える */
.row::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--col) + var(--gap) / 2);
  width: 1px;
  background: var(--line);
  transform-origin: center top;
}

/* 大きな1文字。せり上がりの窓を兼ねるので、行送りの余りを負の余白で削って罫線に寄せる */
.glyph {
  display: block;
  overflow: hidden;
  margin-top: -0.06em;
  margin-bottom: -0.045em;
  margin-left: -0.02em;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: var(--g);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
}

.glyph i {
  display: block;
  width: -moz-fit-content;
  width: fit-content;
  font-style: normal;
  color: var(--text);
}

.cap {
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 0;
  padding-top: 11px;
}

.cap,
.regex {
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-variant-ligatures: none;
  white-space: nowrap;
}

.cap-main {
  font-size: clamp(14px, 4.1vw, 19px);
  line-height: 1.3;
}

.meta {
  color: var(--muted);
}

/* 分岐 (li|nti)。いま一致している側だけに色を差す */
.alt {
  transition: color 0.5s ease;
}

.hero[data-alt="li"] .alt[data-alt="li"],
.hero[data-alt="nti"] .alt[data-alt="nti"] {
  color: var(--ink);
}

.hero[data-alt="li"] .alt[data-alt="nti"],
.hero[data-alt="nti"] .alt[data-alt="li"] {
  color: var(--faint);
}

/* Quality と Quantity の切り替え。Qua と ty は動かさず、真ん中の li（2文字）と nti（3文字）だけを入れ替える。
   同じ場所に2つを重ね、窓（clip-path）の中で、出ていく文字は上へ、入ってくる文字は下から、1文字ずつ時差をつけて送る。
   幅も 2ch と 3ch の間で動かし、後ろの ty を押し引きする。 */
.swap {
  display: inline-grid;
  width: 2ch;
  clip-path: inset(0 -1px);
  transition: width 0.6s cubic-bezier(0.65, 0, 0.35, 1), color 0.6s ease;
}

.hero[data-alt] .swap {
  color: var(--ink);
}

.hero[data-alt="nti"] .swap {
  width: 3ch;
}

.swap > span {
  grid-area: 1 / 1;
}

/* hero.js が動かないとき（1文字ずつに分かれていないとき）は、Quality を静止して見せる */
.swap > [data-alt="nti"] {
  visibility: hidden;
}

.swap > span:has(.ch) {
  visibility: visible;
}

.swap .ch {
  display: inline-block;
  transition: transform 0.6s cubic-bezier(0.65, 0, 0.35, 1), opacity 0.3s ease;
}

.swap .ch:nth-child(2) { transition-delay: 0.05s; }
.swap .ch:nth-child(3) { transition-delay: 0.1s; }

.swap > [data-alt="nti"] .ch,
.hero[data-alt="nti"] .swap > [data-alt="li"] .ch {
  opacity: 0;
}

.swap > [data-alt="nti"] .ch {
  transform: translateY(105%);
}

.hero[data-alt="nti"] .swap > [data-alt="li"] .ch {
  transform: translateY(-105%);
}

.hero[data-alt="nti"] .swap > [data-alt="nti"] .ch {
  opacity: 1;
  transform: none;
}

/* hero.js が1文字ずつに分けたあとの状態。まだ出ていない文字と、定まる前の文字 */
.ch.is-wait {
  opacity: 0;
}

.ch.is-scrambling {
  color: var(--faint);
}

/* 最下段。由来を正規表現そのままの形で1行に示す */
.foot {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
}

.regex {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0.02em;
}

/* 24文字ぶんの幅。等幅なので、幅を 1ch ずつ広げるとタイプしているように見える */
.regex-line {
  display: inline-block;
  box-sizing: content-box;
  width: 24ch;
  overflow: hidden;
  vertical-align: bottom;
  letter-spacing: 0;
  border-right: 2px solid transparent;
}

/* 次の切り替えまでの残りを、最下段の罫線の上に細い色の線で示す */
.tick {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left center;
}

/* 下に続きがあることを示す短い縦線 */
.cue {
  margin: 0;
  height: 18px;
}

.cue span {
  position: relative;
  display: block;
  width: 1px;
  height: 100%;
  overflow: hidden;
  background: var(--line);
}

.cue span::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--text);
  transform: translateY(-100%);
}

/* ---- 会社概要ボタン ----
   Q の行の右下、語の列の幅いっぱいに置き、下の罫線の上に座らせる。
   JavaScript が動くときは隠しておき、下へスクロールしようとしたら出す（about.js が .is-revealed を付ける）。 */

.about-open {
  position: absolute;
  left: calc(var(--col) + var(--gap));
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 44px;
  margin: 0;
  padding: 0 12px;
  border: 0;
  border-radius: 0;
  background: var(--text);
  color: var(--bg);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  clip-path: inset(0);
  -webkit-tap-highlight-color: transparent;
}

.about-open-label,
.about-open-icon {
  display: block;
}

.about-open-icon {
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0;
}

.about-open:focus-visible {
  outline-color: var(--ink);
}

.js .hero:not(.is-revealed) .about-open {
  clip-path: inset(100% 0 0 0);
  pointer-events: none;
}

/* ボタンが出たら、スクロールを促す縦線は役目を終える */
.hero.is-revealed .cue {
  visibility: hidden;
}

/* JavaScript が動かないとき: ボタンは出さず、会社概要をポスターの下にそのまま並べる */
html:not(.js) .about-open,
html:not(.js) .about-close {
  display: none;
}

html:not(.js) .about {
  display: block;
  position: static;
  max-height: none;
  margin: 0 auto;
}

/* JavaScript が動くとき、トップはポスター1枚だけでスクロールしない */
.js body:has(> .hero) {
  overflow: hidden;
}

/* ---- 会社概要のモーダル ----
   スマホでは画面の下に付くシート、広い画面では中央の箱。 */

.about {
  width: 100%;
  max-width: 640px;
  max-height: 88vh;
  margin: auto auto 0;
  padding: 0;
  border: 0;
  border-top: 1px solid var(--text);
  background: var(--bg);
  color: var(--text);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.about::backdrop {
  background: rgba(12, 12, 11, 0.55);
}

.about-inner {
  padding: 4px 20px 28px;
}

.about-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.about-head h2 {
  margin: 0;
}

.about-close {
  width: 44px;
  height: 44px;
  margin: 0 -12px 0 0;
  padding: 0;
  border-radius: 0;
  background: none;
  color: var(--text);
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
}

.about-contact {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 52px;
  margin-top: 32px;
  padding: 0 16px;
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-decoration: none;
}

.about-contact:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

@media (min-width: 700px) {
  .about {
    margin: auto;
    border: 1px solid var(--text);
  }

  .about-inner {
    padding: 12px 32px 32px;
  }
}

/* ---- お問い合わせページ（contact.html）の上端 ---- */

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-top: 24px;
  padding-bottom: 24px;
}

.page-home {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--text);
  text-decoration: none;
}

.page-path {
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  color: var(--muted);
}

/* ---- 動き ----
   順番: 罫線が引かれる → 文字が輪郭のまませり上がる → 下からインクが満ちる
        → 右の語が1文字ずつ定まる → 最下段がタイプされる → 分岐の切り替えが始まる */
@media (prefers-reduced-motion: no-preference) {
  .mark {
    animation: fade 1.2s ease 0.1s both;
  }

  .row::before,
  .foot::before {
    animation: draw-x 1.2s cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  .row:nth-child(1)::before { animation-delay: 0.15s; }
  .row:nth-child(2)::before { animation-delay: 0.25s; }
  .row:nth-child(3)::before { animation-delay: 0.35s; }
  .foot::before { animation-delay: 0.45s; }

  .row::after {
    animation: draw-y 0.7s cubic-bezier(0.65, 0, 0.35, 1) both;
  }

  .row:nth-child(1)::after { animation-delay: 0.3s; }
  .row:nth-child(2)::after { animation-delay: 0.55s; }
  .row:nth-child(3)::after { animation-delay: 0.8s; }

  .glyph i {
    animation: rise 1.1s cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  .row:nth-child(1) .glyph i { --d: 0.35s; }
  .row:nth-child(2) .glyph i { --d: 0.47s; }
  .row:nth-child(3) .glyph i { --d: 0.59s; }

  .glyph i {
    animation-delay: var(--d);
  }

  /* 輪郭だけで現れ、下からインクが満ちる。文字の形で背景を切り抜き、その背景を下から上へ送る */
  @supports ((-webkit-background-clip: text) or (background-clip: text)) {
    .glyph i {
      color: transparent;
      -webkit-text-stroke: 1px var(--text);
      background: linear-gradient(to top, var(--text) 50%, transparent 50%) 0 0 / 100% 200% no-repeat;
      -webkit-background-clip: text;
      background-clip: text;
      animation:
        rise 1.1s cubic-bezier(0.16, 1, 0.3, 1) var(--d) both,
        ink 1.2s cubic-bezier(0.65, 0, 0.35, 1) calc(var(--d) + 0.6s) both;
    }

    /* 押したときに、インクを注ぎ直す */
    .glyph i.is-refill {
      animation: ink 1s cubic-bezier(0.65, 0, 0.35, 1) both;
    }
  }

  .cap-main {
    animation: fade 0.5s ease both;
  }

  .row:nth-child(1) .cap > * { animation-delay: 1.3s; }
  .row:nth-child(2) .cap > * { animation-delay: 1.46s; }
  .row:nth-child(3) .cap > * { animation-delay: 1.62s; }

  .regex-line {
    animation:
      type 1s steps(24, end) 2.3s both,
      caret 3.2s steps(1, end) 2.3s;
  }

  .hero[data-alt="li"] .tick { animation: tick-a 2.8s linear both; }
  .hero[data-alt="nti"] .tick { animation: tick-b 2.8s linear both; }

  .cue {
    animation: fade 0.8s ease 3.2s both;
  }

  .cue span::after {
    animation: cue 2.4s cubic-bezier(0.65, 0, 0.35, 1) 3.6s infinite;
  }

  /* 会社概要ボタン: 下の罫線から黒い面がせり上がり、少し遅れて文字が上がってくる */
  .about-open {
    transition: clip-path 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .about-open-label,
  .about-open-icon {
    transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.12s, opacity 0.4s ease 0.12s;
  }

  .about-open-icon {
    transition-delay: 0.2s;
  }

  .js .hero:not(.is-revealed) .about-open-label,
  .js .hero:not(.is-revealed) .about-open-icon {
    opacity: 0;
    transform: translateY(14px);
  }

  .about-open:active .about-open-icon {
    transform: rotate(90deg);
    transition-delay: 0s;
    transition-duration: 0.3s;
  }

  /* モーダル: 下から上がり、中の行が時差をつけて現れる */
  .about[open] {
    animation: sheet-in 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  .about[open]::backdrop {
    animation: fade 0.4s ease both;
  }

  .about[open] .about-head,
  .about[open] .about-body > *,
  .about[open] .profile > div {
    animation: enter 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  .about[open] .about-head { animation-delay: 0.1s; }
  .about[open] .profile > div:nth-child(1) { animation-delay: 0.16s; }
  .about[open] .profile > div:nth-child(2) { animation-delay: 0.22s; }
  .about[open] .profile > div:nth-child(3) { animation-delay: 0.28s; }
  .about[open] .profile > div:nth-child(4) { animation-delay: 0.34s; }
  .about[open] .about-body > .profile { animation: none; }
  .about[open] .about-contact { animation-delay: 0.4s; }
  .about[open] .about-body > .note { animation-delay: 0.46s; }

  .about.is-closing {
    animation: sheet-out 0.28s cubic-bezier(0.4, 0, 1, 1) both;
  }

  .about.is-closing::backdrop {
    animation: backdrop-out 0.28s ease both;
  }

  .about-contact span:last-child {
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .about-contact:hover span:last-child,
  .about-contact:active span:last-child {
    transform: translateX(4px);
  }
}

@keyframes rise {
  from { transform: translateY(102%); }
  to { transform: none; }
}

@keyframes ink {
  from { background-position: 0 0; -webkit-text-stroke-color: var(--text); }
  70% { -webkit-text-stroke-color: var(--text); }
  to { background-position: 0 100%; -webkit-text-stroke-color: transparent; }
}

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes draw-x {
  from { transform: scaleX(0); }
  to { transform: none; }
}

@keyframes draw-y {
  from { transform: scaleY(0); }
  to { transform: none; }
}

@keyframes type {
  from { width: 0; }
  to { width: 24ch; }
}

/* 打ち終わるまでは点灯したまま、そのあと2回点滅して消える */
@keyframes caret {
  0% { border-right-color: var(--ink); }
  50% { border-right-color: transparent; }
  67% { border-right-color: var(--ink); }
  83%, 100% { border-right-color: transparent; }
}

/* 同じ動きを2つの名前で持つ。data-alt が変わるたびに名前が変わり、最初からやり直される */
@keyframes tick-a {
  from { transform: scaleX(0); }
  to { transform: none; }
}

@keyframes tick-b {
  from { transform: scaleX(0); }
  to { transform: none; }
}

@keyframes sheet-in {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

@keyframes sheet-out {
  from { transform: none; opacity: 1; }
  to { transform: translateY(24px); opacity: 0; }
}

@keyframes backdrop-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes enter {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

@keyframes cue {
  0% { transform: translateY(-100%); }
  50% { transform: none; }
  100% { transform: translateY(100%); }
}
}

section {
  padding: 48px 0;
  border-top: 1px solid var(--line);
}

h2,
.page-title {
  margin: 0 0 24px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.profile {
  margin: 0;
}

.profile > div {
  display: grid;
  grid-template-columns: 7em 1fr;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.profile > div:first-child {
  padding-top: 0;
}

.profile > div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.profile dt {
  color: var(--muted);
}

.profile dd {
  margin: 0;
}

.profile ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.reading {
  color: var(--muted);
}

.field {
  margin-top: 20px;
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
}

.required {
  margin-left: 6px;
  font-size: 12px;
  color: var(--muted);
}

input,
textarea {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--field);
  color: var(--text);
  font: inherit;
  line-height: 1.6;
}

textarea {
  resize: vertical;
}

input:focus-visible,
textarea:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--error);
}

.trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.note {
  margin: 20px 0 0;
  font-size: 13px;
  color: var(--muted);
}

button {
  margin-top: 20px;
  padding: 12px 28px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

button:disabled {
  opacity: 0.5;
  cursor: default;
}

.status {
  min-height: 1.8em;
  margin: 16px 0 0;
  font-size: 14px;
}

.status[data-kind="error"] {
  color: var(--error);
}

.status[data-kind="ok"] {
  color: var(--ok);
}

footer {
  padding-top: 32px;
  padding-bottom: 48px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}

footer p {
  margin: 0;
}

@media (max-width: 480px) {
  .profile > div {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}
