/* ==========================================================================
   toma.biz — "scroll story" layout (light theme)
   One idea runs through the whole page: simple and fast. So the page is
   light, uses few colors, and each section is one big, clear moment.

   Sections of this file:
   1. Design tokens    2. Reset/base    3. Header + side rail    4. Hero
   5. Buttons          6. Work stories  7. About (letters light up)
   8. Contact + form   9. Footer        10. Animations + reduced motion
   11. Small screens
   ========================================================================== */

/* ==========================================================================
   1. DESIGN TOKENS
   Colors and sizes live here as variables, so changing one line here
   changes the whole site.
   ========================================================================== */
:root {
  --bg: #141416;              /* warm charcoal page background (not pure black) */
  --bg-alt: #1b1b1e;          /* a step lighter, used to separate sections */
  --surface: #232327;         /* browser frames / raised things */
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.3); /* borders you need to SEE (inputs, buttons) */

  --text: #f2f0eb;            /* soft warm white (pure white is too harsh on dark) */
  --text-muted: #a5a39d;      /* secondary text */

  --accent: #7ea6ff;          /* soft blue, bright enough to read on dark */
  --accent-hover: #a2bfff;
  --accent-soft: rgba(126, 166, 255, 0.1);
  --on-accent: #0f1115;       /* dark text on top of the blue buttons */

  /* The contact panel at the bottom: one step lighter than the page */
  --ink: #202024;
  --ink-text: #f2f0eb;
  --ink-muted: #a5a39d;
  --ink-accent: #9ebcff;

  --font-jp: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Hiragino Sans",
    "Yu Gothic", "Meiryo", system-ui, -apple-system, sans-serif;
  --font-mono: var(--font-jp); /* small labels use the normal font now (no "code" look) */

  --ease: cubic-bezier(0.22, 1, 0.36, 1); /* fast start, soft landing: used for everything that moves */
  --container-width: 1280px;  /* wide enough for the one-line title; every section shares it so edges line up */
  --header-h: 64px;
  --radius: 14px;
}

/* ==========================================================================
   2. RESET / BASE
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;                 /* nav links glide instead of jump */
  scroll-padding-top: calc(var(--header-h) + 8px); /* so the sticky header doesn't cover section titles */
  overflow-x: hidden;                      /* fallback for old browsers... */
  overflow-x: clip;                        /* ...and this one never lets the page slide sideways */
}

body {
  font-family: var(--font-jp);
  background: var(--bg);
  color: var(--text);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overflow-x: clip;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

main:focus {
  outline: none;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.container {
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* "Skip to content" link for keyboard users: invisible until you Tab to it */
.skip {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 300;
  background: var(--accent);
  color: var(--on-accent);
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 700;
}
.skip:focus {
  top: 12px;
}

/* ==========================================================================
   3. HEADER + SIDE RAIL
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(20, 20, 22, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-weight: 900;
  font-size: 1.3rem;
  letter-spacing: 0.02em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 0.92rem;
  font-weight: 500;
}

.site-nav a {
  color: var(--text-muted);
  transition: color 0.25s var(--ease);
}
.site-nav a:hover {
  color: var(--text);
}

.site-nav .nav-cta {
  color: var(--on-accent);
  background: var(--accent);
  padding: 8px 18px;
  border-radius: 999px;
  font-weight: 700;
  transition: background 0.25s var(--ease);
}
.site-nav .nav-cta:hover {
  color: var(--on-accent);
  background: var(--accent-hover);
}

.site-nav .lang-switch {
  font-size: 0.8rem;
  font-family: var(--font-mono);
  border: 1px solid var(--border-strong);
  padding: 4px 10px;
  border-radius: 6px;
}

/* Hamburger button (small screens only) */
.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
}

/* The side rail: a thin line on the right edge that fills as you scroll,
   with a dot for each section. This is the "signature" of the page. */
.rail {
  position: fixed;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 50;
  height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
}
.rail-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  margin-left: -1px;
  background: var(--border);
  overflow: hidden;
}
.rail-fill {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--accent);
  transform-origin: top;
  transform: scaleY(0);          /* the script sets this from 0 to 1 while you scroll */
}
.rail a {
  position: relative;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--border-strong);
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease), transform 0.3s var(--ease);
}
.rail a.is-active {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(1.35);
}

/* ==========================================================================
   4. HERO
   ========================================================================== */
.hero {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 96px 0 56px; /* no fixed height: the hero is exactly as tall as its content, so no empty gap below it */
}

/* Faint grid + soft blue glow behind the title */
.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: radial-gradient(ellipse 60% 55% at 20% 30%, var(--accent-soft), transparent 70%);
}

.hero .container {
  position: relative;
  z-index: 1;
}

.eyebrow {
  font-family: var(--font-mono);
  color: var(--accent);
  font-weight: 500;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
}

/* The title stays on ONE line on desktop. The size is the original size. */
.hero h1 {
  font-size: clamp(1.7rem, 4.6vw, 2.75rem);
  font-weight: 900;
  line-height: 1.4;
  margin-bottom: 20px;
  letter-spacing: -0.03em;
  text-wrap: balance; /* if it has to wrap on a small screen, wrap evenly */
}

.hero-sub {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 640px;
  margin-bottom: 28px;
}

/* Small badge in the hero: says the service is for customers in Japan only */
.region {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  padding: 7px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
}
.region span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.hero .region + .btn {
  display: table;                    /* put the button on its own line under the badge */
}

/* ==========================================================================
   5. BUTTONS
   ========================================================================== */
.btn {
  display: inline-block;
  font-family: var(--font-jp);
  font-weight: 700;
  font-size: 1rem;
  padding: 14px 32px;
  border-radius: 999px;
  cursor: pointer;
  border: none;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.25s var(--ease);
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 4px 18px rgba(126, 166, 255, 0.22);
}
.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(126, 166, 255, 0.32);
}
.btn-primary:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* ==========================================================================
   6. WORK: every case is a big "story" row (picture on one side, text on the
   other, flipping sides each time)
   ========================================================================== */
.section {
  padding: 72px 0 40px;
}

.section-head {
  max-width: 640px;
  margin-bottom: 24px;
}

.section-eyebrow {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.section-title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 900;
  line-height: 1.25;
  margin-bottom: 14px;
}

.section-lead {
  color: var(--text-muted);
  font-size: 1.02rem;
}

.story {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: 56px;
  align-items: center;
  padding: 72px 0;
  border-top: 1px solid var(--border);
}
.story:first-child {
  border-top-color: var(--border-strong);
}

.story-media {
  grid-column: 1 / 8;
  grid-row: 1;
}
.story-body {
  grid-column: 8 / 13;
  grid-row: 1;
}
/* Every second story flips: picture on the right */
.story:nth-child(even) .story-media {
  grid-column: 6 / 13;
}
.story:nth-child(even) .story-body {
  grid-column: 1 / 6;
}

/* A fake browser window around each screenshot */
.frame {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 40px 70px -40px rgba(0, 0, 0, 0.7);
  transition: transform 0.6s var(--ease), box-shadow 0.6s var(--ease);
}
.story-media:hover .frame {
  transform: translateY(-6px);
  box-shadow: 0 50px 80px -40px rgba(0, 0, 0, 0.75);
}
.frame-bar {
  display: flex;
  gap: 6px;
  padding: 11px 14px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}
.frame-bar i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
}
.frame img {
  width: 100%;
  height: auto; /* show the whole screenshot, edge to edge, nothing cropped */
}

.story-num {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.case-client {
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.case-title {
  font-size: clamp(1.8rem, 3.4vw, 2.5rem);
  font-weight: 900;
  line-height: 1.25;
  margin-bottom: 24px;
}

.facts div {
  padding: 14px 0;
  border-top: 1px solid var(--border);
}
.facts dt {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  margin-bottom: 2px;
}
.facts dd {
  font-size: 0.95rem;
}

.case-link {
  display: inline-block;
  margin-top: 18px;
  font-weight: 700;
  color: var(--accent);
  border-bottom: 2px solid transparent;
  transition: border-color 0.25s var(--ease);
}
.case-link:hover {
  border-bottom-color: var(--accent);
}

/* ==========================================================================
   6b. PROCESS + PRICE: three steps in a row, then one big price panel
   ========================================================================== */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0 48px;
  margin-top: 48px;
  counter-reset: none;
}
.step {
  padding-top: 24px;
  border-top: 1px solid var(--border-strong);
}
.step-num {
  display: block;
  font-size: 3.2rem;
  font-weight: 900;
  line-height: 1;
  color: var(--accent);
  margin-bottom: 18px;
}
.step-title {
  font-size: 1.4rem;
  font-weight: 900;
  margin-bottom: 8px;
}
.step p {
  color: var(--text-muted);
  font-size: 0.97rem;
}

.price {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
  margin-top: 64px;
  padding: 40px 48px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
}
.price-label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 4px;
}
.price-num {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 900;
  line-height: 1.2;
  white-space: nowrap;
}
.price-side {
  display: flex;
  align-items: center;
  gap: 32px;
  max-width: 560px;
  color: var(--text-muted);
}
.price-side .btn {
  flex-shrink: 0;
}

/* Domain button: a small pill that opens a pop-up window over the whole page */
.domain-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  cursor: pointer;
  padding: 10px 20px;
  background: none;
  color: var(--text);
  font-family: var(--font-jp);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
  transition: border-color 0.25s var(--ease), color 0.25s var(--ease);
}
.domain-btn::after {
  content: "+";
  font-size: 1.2rem;
  line-height: 1;
  color: var(--accent);
}
.domain-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* The pop-up. <dialog> is a built-in HTML tag: when opened with showModal()
   the browser puts it on top of everything, dims the page behind it
   (that is the ::backdrop), and closes it when you press Esc. */
.modal {
  position: fixed;
  inset: 0;
  margin: auto;                       /* centers it on the screen */
  width: min(680px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 48px 48px 40px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.6);
}
.modal[open] {
  animation: modal-in 0.35s var(--ease);
}
.modal::backdrop {
  background: rgba(10, 10, 12, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}
.modal-title {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 900;
  line-height: 1.3;
  margin-bottom: 24px;
  padding-right: 48px;                /* keep the title away from the close button */
}
.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--text);
  font-size: 0;                       /* hide the text "x": fonts place it slightly off-center */
  cursor: pointer;
  transition: transform 0.25s var(--ease);
}
/* Draw the x ourselves with two thin bars, so it is exactly in the middle */
.modal-close::before,
.modal-close::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 2px;
  margin: -1px 0 0 -9px;              /* half of the size, so the center sits on the center */
  background: var(--bg);
  border-radius: 1px;
}
.modal-close::before {
  transform: rotate(45deg);
}
.modal-close::after {
  transform: rotate(-45deg);
}
.modal-close:hover {
  transform: scale(1.08);
}
/* stop the page behind from scrolling while the pop-up is open */
body:has(dialog[open]) {
  overflow: hidden;
}

.domain-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  color: var(--text-muted);
  font-size: 1rem;
}
.domain-list li {
  position: relative;
  padding-left: 22px;
}
.domain-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.75em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

/* ==========================================================================
   7. ABOUT: the text starts grey and every letter turns black as you scroll
   ========================================================================== */
.about {
  background: var(--bg-alt);
  padding: 120px 0;
  margin-top: 56px;
}

.about-name {
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.fill {
  max-width: 920px;
}
.fill-p {
  font-size: clamp(1.3rem, 2.6vw, 2.05rem);
  font-weight: 700;
  line-height: 1.75;
  margin-bottom: 1.2em;
}
.fill-p .ch {
  opacity: 0.22;
  transition: opacity 0.35s var(--ease);
}
.fill-p .ch.on {
  opacity: 1;
}

/* ==========================================================================
   8. CONTACT + FORM (dark "ink" panel)
   ========================================================================== */
.contact {
  background: var(--ink);
  color: var(--ink-text);
  border-radius: 36px 36px 0 0;
  border-top: 1px solid var(--border);
  padding: 120px 0 96px;
}
.contact .section-eyebrow {
  color: var(--ink-accent);
}
.contact .section-lead {
  color: var(--ink-muted);
}

.contact-inner {
  display: grid;
  grid-template-columns: 5fr 6fr;
  column-gap: 80px;
  align-items: start;
}

.contact-region {
  margin-top: 20px;
  color: var(--ink-text);
  font-weight: 700;
  font-size: 0.95rem;
}

.contact-fallback {
  margin-top: 28px;
  font-size: 0.9rem;
  color: var(--ink-muted);
}
.contact-fallback a {
  color: var(--ink-accent);
  border-bottom: 1px solid currentColor;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.form-row label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
}
.form-row input,
.form-row textarea {
  font-family: var(--font-jp);
  font-size: 1rem;
  color: var(--ink-text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 10px;
  padding: 14px 16px;
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease);
}
.form-row input:focus,
.form-row textarea:focus {
  outline: none;
  border-color: var(--ink-accent);
  background: rgba(255, 255, 255, 0.1);
}
.form-row textarea {
  resize: vertical;
}

.contact-form .btn {
  align-self: flex-start;
}

.form-error {
  color: #ffa5a5;
  font-size: 0.9rem;
}

.form-success {
  padding: 36px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: var(--radius);
}
.form-success-title {
  font-size: 1.3rem;
  font-weight: 900;
  margin-bottom: 6px;
}
.form-success-note {
  color: var(--ink-muted);
  margin-bottom: 22px;
}

/* hidden attribute must win over the display rules above */
[hidden] {
  display: none !important;
}

/* ==========================================================================
   9. FOOTER (continues the dark panel)
   ========================================================================== */
.site-footer {
  background: var(--ink);
  color: var(--ink-muted);
  border-top: 1px solid var(--border);
  padding: 28px 0;
  font-size: 0.85rem;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.logo-small {
  color: var(--ink-text);
  font-size: 1.1rem;
}

/* ==========================================================================
   10. ANIMATIONS
   Things fade/slide up when they scroll into view (the script adds ".in").
   Everything only hides if JavaScript is on (".js"), so the page is
   always readable even if the script fails.
   ========================================================================== */
.js .rv {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
  transition-delay: calc(var(--i, 0) * 110ms);
}
.js .rv.in {
  opacity: 1;
  transform: none;
}
/* After the entrance is over, remove the stagger delay so hovers feel instant.
   (".rv.in.done" is more specific than ".rv.in" so this reliably wins.) */
.js .rv.in.done {
  transition-delay: 0s;
}

/* Reduced motion: people who turn this on in their system settings get no
   movement at all, just the finished page. */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    transition-delay: 0s !important;
  }
  .js .rv {
    opacity: 1;
    transform: none;
  }
  .fill-p .ch {
    opacity: 1;
  }
}

/* ==========================================================================
   11. SMALL SCREENS
   ========================================================================== */
@media (pointer: coarse) {
  .btn,
  .site-nav a {
    min-height: 44px;
  }
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

@media (max-width: 1100px) {
  .rail {
    display: none;
  }
}

@media (max-width: 900px) {
  .steps {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .price,
  .price-side {
    flex-direction: column;
    align-items: flex-start;
    gap: 24px;
  }
  .price {
    padding: 32px 28px;
  }
  .modal {
    padding: 40px 24px 28px;
  }
  .story,
  .story:nth-child(even) {
    display: block;
    padding: 56px 0;
  }
  .story-media {
    display: block;
    margin-bottom: 28px;
  }

  .contact-inner {
    display: block;
  }
  .contact-panel {
    margin-top: 40px;
  }
}

@media (max-width: 720px) {
  .nav-toggle {
    display: flex;
  }

  /* On phones the nav becomes a dropdown panel under the header */
  .site-nav {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 12px 24px 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
  }
  .site-nav.is-open {
    display: flex;
  }
  .site-nav a {
    padding: 12px 0;
    font-size: 1rem;
  }
  .site-nav .nav-cta {
    text-align: center;
    margin-top: 8px;
    padding: 12px 18px;
  }
  .site-nav .lang-switch {
    align-self: flex-start;
    margin-top: 8px;
    padding: 6px 12px;
  }

  .hero {
    padding: 48px 0 24px;
  }

  .section {
    padding: 80px 0 24px;
  }
  .about {
    padding: 96px 0;
    margin-top: 48px;
  }
  .contact {
    padding: 80px 0 72px;
    border-radius: 24px 24px 0 0;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }
}

/* Text for screen readers only (visually hidden). The About text is shown as
   separate letters for the light-up effect, so this keeps a normal copy for them. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
