:root {
  --bg: #9a9a9a;
  --fg: #000;
  --line: rgba(0, 0, 0, .28);
  --gutter: clamp(16px, 4vw, 56px);
  /* shared size for the service list and the contact address (80% of the former service size) */
  --item: clamp(14.4px, 1.6vw, 22.4px);
  --item-pc: clamp(14.4px, min(1.6vw, 2.56vh), 22.4px);
  --en: "Inter", sans-serif;
  --ja: "Shippori Antique", sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--en), var(--ja);
  font-size: 15px;
  font-optical-sizing: auto;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

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

h1, h2, p, ol, dl, dd { margin: 0; padding: 0; }

/* ---------- ambient layers ---------- */

.grain {
  position: fixed;
  inset: -50%;
  z-index: 50;
  pointer-events: none;
  opacity: .14;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1s steps(4) infinite;
}

@keyframes grain {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-3%, 2%); }
  50% { transform: translate(2%, -3%); }
  75% { transform: translate(-1%, 3%); }
}

/* scroll-driven progress (falls back to JS where unsupported) */
.progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  z-index: 60;
  background: var(--fg);
  transform-origin: 0 50%;
  transform: scaleX(var(--p, 0));
}

@supports (animation-timeline: scroll()) {
  .progress {
    animation: progress linear both;
    animation-timeline: scroll(root);
  }
  @keyframes progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
}

/* ---------- header ---------- */

.header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 40;
  display: flex;
  align-items: center;
  padding: 20px var(--gutter);
}

.brand { display: inline-flex; align-items: center; gap: 10px; justify-self: start; }

.mark, .footer-mark { width: 17px; height: 17px; fill: var(--fg); }
/* filter keeps the bitmap logo pure #000 */
.brand-logo { display: block; width: 200px; max-width: 46vw; height: auto; filter: brightness(0); }
/* door part of the logo stays empty until the intro mark lands in it */
.is-logo-pending .brand-logo { clip-path: inset(23% 0 0 5%); }
/* ---------- hero ---------- */

main { position: relative; z-index: 1; }

.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 120px var(--gutter) clamp(32px, 6vh, 64px);
  position: relative;
}

.hero-title {
  font-weight: 500;
  font-size: clamp(28px, 4.6vw, 110px);
  white-space: nowrap;
  line-height: 1.05;
  letter-spacing: -.035em;
}

.line { display: inline-block; vertical-align: top; overflow: hidden; padding-bottom: .14em; margin-bottom: -.1em; }
.word {
  display: inline-block;
  transform: translateY(105%);
  animation: rise 1.2s var(--ease) forwards;
}
.line:nth-child(2) .word { animation-delay: .1s; font-weight: 200; }
/* "is the Dis" thin, so the bold parts read "This … covery" */
.hero-title .thin { font-weight: 200; }
.line:nth-child(3) .word { animation-delay: .2s; }

@keyframes rise { to { transform: translateY(0); } }

/* hold hero motion until the intro has faded */
.is-intro .word { animation-play-state: paused; }

/* door mark sitting at the centre of the top view; the intro mark lands exactly on it */
.hero-mark,
.intro-mark { width: clamp(88px, 10vw, 150px); height: auto; overflow: visible; }

.hero-mark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  fill: var(--fg);
}

/* ---------- intro: mark draws in, darkness fades, mark turns black ---------- */

.intro {
  position: fixed;
  inset: 0;
  z-index: 200;
  height: 100svh;
  cursor: pointer;
}

.intro-door {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--fg);
}

.intro-mark { fill: var(--bg); }

.intro-jamb {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  transform: scaleY(0);
  animation: jamb .7s .2s var(--ease) forwards;
}
.intro-head {
  clip-path: inset(0 100% 0 0);
  animation: head .6s .8s var(--ease) forwards;
}

@keyframes jamb { to { transform: scaleY(1); } }
@keyframes head { to { clip-path: inset(0 0 0 0); } }

.intro.is-open .intro-door { animation: unveil 1.4s cubic-bezier(.45, 0, .25, 1) forwards; }
.intro.is-open .intro-mark { animation: ink 1.4s cubic-bezier(.45, 0, .25, 1) forwards; }
/* skipping early: finish drawing the mark at once */
.intro.is-open .intro-jamb,
.intro.is-open .intro-head { animation: none; transform: none; clip-path: none; }
.is-intro { overflow: hidden; }

@keyframes unveil { to { background-color: transparent; } }
@keyframes ink { to { fill: var(--fg); } }


/* ---------- sections ---------- */

.section {
  padding: clamp(96px, 16vh, 180px) var(--gutter) 0;
  display: grid;
  gap: 28px;
  align-items: start;
}

.label {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .01em;
}
/* service rows */
.services { list-style: none; }

.service { padding: 6px 0; }

.service-name {
  font-weight: 500;
  font-size: var(--item);
  line-height: 1.15;
  letter-spacing: -.02em;
}

/* company */
.company { font-family: var(--ja); }
.company > div {
  display: grid;
  gap: 2px;
  padding: 10px 0;
}
.company dt { font-size: 14px; opacity: .6; }
.company dd { font-size: 15px; }
.company small { display: block; font-family: var(--en); font-size: 12px; opacity: .6; }

/* contact */
.contact { padding-bottom: clamp(96px, 16vh, 180px); }

.contact-mail {
  display: inline-flex;
  align-items: center;
  gap: .3em;
  justify-self: start;
  max-width: 100%;
  font-size: var(--item);
  font-weight: 500;
  letter-spacing: -.02em;
  line-height: 1.05;
}
.contact-text { overflow-wrap: anywhere; }

.copy {
  justify-self: start;
  margin-top: 8px;
  padding: 10px 18px;
  border: 1px solid var(--fg);
  border-radius: 99px;
  background: transparent;
  color: var(--fg);
  font: 500 12px/1 var(--en);
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
}
.copy.is-done { background: var(--fg); color: var(--bg); }

/* reveal — native scroll-driven where possible, JS IntersectionObserver otherwise */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 1s var(--ease), transform 1s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }

@supports (animation-timeline: view()) {
  .reveal, .reveal.is-in {
    opacity: 1;
    transform: none;
    transition: none;
    animation: reveal linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 70%;
  }
  @keyframes reveal { from { opacity: 0; transform: translateY(32px); } to { opacity: 1; transform: none; } }
}

/* ---------- footer ---------- */

.footer {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px var(--gutter);
  border-top: 1px solid var(--line);
  font-size: 12px;
}
.footer p { flex: 1; }
.footer-mark { width: 16px; height: 16px; }

/* ---------- responsive ---------- */

@media (max-width: 760px) {
  .footer { flex-wrap: wrap; }
}

/* PC: everything fits one screen — headline bottom-left, content in a right-hand panel */
@media (min-width: 761px) {
  html, body { height: 100%; overflow: hidden; }
  .brand-logo { width: 280px; max-width: none; }
  .hero { height: 100svh; min-height: 0; }
  .hero-title {
    position: fixed;
    left: var(--gutter);
    bottom: clamp(32px, 6vh, 64px);
    z-index: 30;
  }

  .panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: max(50%, calc(100% - 540px));
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(40px, 6vh, 88px) var(--gutter) clamp(32px, 6vh, 64px);
    overflow-y: auto;
    opacity: 0;
    transition: opacity 1.2s var(--ease);
  }
  .is-ready .panel { opacity: 1; }

  .panel .section { padding: 0; gap: clamp(12px, 2.2vh, 28px); }
  .panel .service { padding: clamp(1px, .4vh, 6px) 0; }
  .panel .service-name { font-size: var(--item-pc); }
  .panel .company > div { padding: clamp(2px, .6vh, 10px) 0; gap: 0; }
  .panel .company dt { font-size: 12px; }
  .panel .company { line-height: 1.45; }
  .panel .contact-mail { font-size: var(--item-pc); white-space: nowrap; }
  .panel .reveal { animation: none; opacity: 1; transform: none; }

  .progress,
  .copy,
  .footer { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
  .grain { animation: none; }
  .intro { display: none; }
  .reveal { opacity: 1; transform: none; }
}

.copy {
	display: none;
}