/* Intecoda shared design system — loaded by every page. Page-specific styles stay inline in each page. */

:root {
  /* Surfaces */
  --c-bg: #0a0a0b;
  --c-surface: #111113;
  --c-surface-2: #16161a;
  --c-surface-3: #1c1c21;
  --c-line: rgba(255, 255, 255, 0.08);
  --c-line-strong: rgba(255, 255, 255, 0.14);

  /* Text (softened whites, not pure #fff) */
  --c-text: #e9e8e3;
  --c-text-strong: #f6f5f1;
  --c-text-muted: #a3a3a9;
  --c-text-subtle: #86868c;

  /* Champagne gold — used sparingly: CTA, key headings, icons, hairlines */
  --c-gold: #c9ab6d;
  --c-gold-soft: #e3cf9f;
  --c-gold-deep: #9c824f;
  --c-gold-line: rgba(201, 171, 109, 0.32);
  --c-gold-wash: rgba(201, 171, 109, 0.08);
  --c-on-gold: #16130b;

  --radius-s: 6px;
  --radius-m: 10px;
  --radius-l: 16px;

  --container: 1160px;
  --gutter: clamp(20px, 5vw, 40px);
  --header-h: 72px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN",
    "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;

  /* Legacy aliases so each page's existing inline CSS adopts the new palette. */
  --bg: var(--c-bg);
  --panel: var(--c-surface);
  --panel2: var(--c-surface-2);
  --text: var(--c-text);
  --muted: var(--c-text-muted);
  --line: var(--c-line);
  --gold: var(--c-gold);
  --gold2: var(--c-gold-soft);
  --max: var(--container);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.85;
  letter-spacing: 0.02em;
  font-feature-settings: "palt" 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body.is-locked {
  overflow: hidden;
}

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

img,
video {
  max-width: 100%;
  height: auto;
}

h1,
h2,
h3,
h4 {
  color: var(--c-text-strong);
  line-height: 1.35;
  letter-spacing: 0.01em;
  word-break: auto-phrase;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

/* Short, list-like Japanese text breaks between phrases instead of mid-word (Chromium 119+). */
dd,
dt,
li,
summary,
figcaption {
  word-break: auto-phrase;
  text-wrap: pretty;
}

:focus-visible {
  outline: 2px solid var(--c-gold-soft);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection {
  background: rgba(201, 171, 109, 0.35);
  color: var(--c-text-strong);
}

.container {
  width: min(100% - var(--gutter) * 2, var(--container));
  margin-inline: auto;
}

/* Keep a Japanese phrase on one line; the heading breaks only between phrases. */
.nw {
  display: inline-block;
}

/* On very narrow screens a single phrase can exceed the line; let it break normally. */
@media (max-width: 359px) {
  .nw {
    display: inline;
  }
}

/* Grid and flex children default to min-width:auto, so one long unbreakable phrase can
   widen a track past the viewport on small screens. :where() keeps specificity at zero,
   so any page rule that sets min-width still wins. Images are deliberately excluded. */
main :where(div, section, article, aside, header, ul, ol, li, dl, form)[class] > :where(div, section, article, aside, header, h1, h2, h3, h4, p, ul, ol, li, dl, dd, a, span, figure, form, label) {
  min-width: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 2000;
  padding: 10px 16px;
  border-radius: var(--radius-s);
  background: var(--c-gold);
  color: var(--c-on-gold);
  font-weight: 700;
  transition: top 0.2s var(--ease);
}

.skip-link:focus {
  top: 12px;
}

/* ---------- Buttons ---------- */

.ui-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 26px;
  border-radius: var(--radius-s);
  border: 1px solid transparent;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.3;
  text-align: center;
  cursor: pointer;
  transition:
    background-color 0.25s var(--ease),
    border-color 0.25s var(--ease),
    color 0.25s var(--ease),
    transform 0.25s var(--ease);
}

.ui-btn-primary {
  background: var(--c-gold);
  color: var(--c-on-gold);
}

.ui-btn-primary:hover {
  background: var(--c-gold-soft);
}

.ui-btn-ghost {
  border-color: var(--c-line-strong);
  color: var(--c-text-strong);
  background: rgba(255, 255, 255, 0.02);
}

.ui-btn-ghost:hover {
  border-color: var(--c-gold-line);
  color: var(--c-gold-soft);
}

.ui-btn .arrow {
  transition: transform 0.25s var(--ease);
}

.ui-btn:hover .arrow {
  transform: translateX(3px);
}

/* Harmonize the legacy per-page button variants (.btn / .btn-primary / .btn.primary)
   with the shared button language; `main` raises specificity above each page's inline rules. */
main .btn {
  min-height: 52px;
  border-radius: var(--radius-s);
}

main .btn-primary,
main .btn.primary {
  background: var(--c-gold);
  color: var(--c-on-gold);
  border-color: transparent;
}

main .btn-primary:hover,
main .btn.primary:hover {
  background: var(--c-gold-soft);
  transform: none;
  box-shadow: none;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--c-gold-soft);
  font-weight: 700;
  font-size: 0.95rem;
}

.text-link .arrow {
  transition: transform 0.25s var(--ease);
}

.text-link:hover .arrow {
  transform: translateX(3px);
}

/* ---------- Section primitives ---------- */

.ui-kicker {
  display: inline-flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0 0 18px;
  color: var(--c-gold);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.ui-kicker::before {
  content: "";
  flex: none;
  margin-top: 0.85em;
  width: 28px;
  height: 1px;
  background: var(--c-gold-line);
}

@media (max-width: 479px) {
  .ui-kicker {
    letter-spacing: 0.16em;
  }
}

.ui-section {
  padding-block: clamp(80px, 11vw, 140px);
}

.ui-section-head {
  display: grid;
  gap: 20px;
  margin-bottom: clamp(40px, 6vw, 64px);
}

.ui-section-head h2 {
  margin: 0;
  font-size: clamp(1.75rem, 1.2rem + 2vw, 2.6rem);
}

.ui-section-head p {
  margin: 0;
  max-width: 40em;
  color: var(--c-text-muted);
}

@media (min-width: 900px) {
  .ui-section-head.split {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: end;
    gap: 48px;
  }
}

.divider {
  border: 0;
  border-top: 1px solid var(--c-line);
  margin: 0;
}

/* ---------- Header ---------- */

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 1000;
  height: var(--header-h);
  border-bottom: 1px solid transparent;
  transition:
    background-color 0.3s var(--ease),
    border-color 0.3s var(--ease),
    height 0.3s var(--ease);
}

.site-header.is-scrolled {
  height: 64px;
  background: rgba(10, 10, 11, 0.82);
  border-bottom-color: var(--c-line);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  backdrop-filter: saturate(140%) blur(14px);
}

.site-header .bar {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--c-text-strong);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.14em;
}

.brand img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.gnav {
  display: none;
  align-items: center;
  gap: 4px;
}

.gnav > a {
  position: relative;
  padding: 10px 14px;
  color: var(--c-text-muted);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: color 0.2s var(--ease);
}

.gnav > a:hover,
.gnav > a[aria-current="page"] {
  color: var(--c-text-strong);
}

.gnav > a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 4px;
  height: 1px;
  background: var(--c-gold);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-cta {
  display: none;
  min-height: 42px;
  padding: 0 18px;
  font-size: 0.85rem;
}

@media (min-width: 1024px) {
  .gnav,
  .header-cta {
    display: inline-flex;
  }

  .menu-toggle {
    display: none !important;
  }
}

/* Language switcher (homepage only; ids/classes are referenced by assets/home-i18n.js) */

.lang-switch {
  position: relative;
}

.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--c-line);
  border-radius: var(--radius-s);
  background: transparent;
  color: var(--c-text-muted);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.lang-toggle:hover {
  color: var(--c-text-strong);
  border-color: var(--c-line-strong);
}

.lang-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 150px;
  margin: 0;
  padding: 6px;
  list-style: none;
  border: 1px solid var(--c-line-strong);
  border-radius: var(--radius-m);
  background: var(--c-surface-2);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition:
    opacity 0.2s var(--ease),
    transform 0.2s var(--ease),
    visibility 0.2s;
}

.lang-menu.open {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.lang-menu button,
.lang-switch-mobile button {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-s);
  background: transparent;
  color: var(--c-text-muted);
  font: inherit;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
}

.lang-menu button:hover,
.lang-menu button[aria-selected="true"] {
  background: var(--c-gold-wash);
  color: var(--c-gold-soft);
}

.lang-switch-desktop {
  display: none;
}

@media (min-width: 1024px) {
  .lang-switch-desktop {
    display: block;
  }
}

/* Menu toggle + drawer */

.menu-toggle {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 48px;
  height: 48px;
  margin-right: -8px;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.menu-toggle span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: var(--c-text-strong);
  transition:
    transform 0.3s var(--ease),
    opacity 0.2s var(--ease);
}

.menu-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.menu-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg);
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  flex-direction: column;
  padding: calc(var(--header-h) + 8px) var(--gutter) max(24px, env(safe-area-inset-bottom));
  background: var(--c-bg);
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.25s var(--ease),
    visibility 0.25s;
}

.drawer.open {
  opacity: 1;
  visibility: visible;
}

.drawer nav {
  display: flex;
  flex-direction: column;
}

.drawer nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  border-bottom: 1px solid var(--c-line);
  color: var(--c-text-strong);
  font-size: 1.05rem;
  font-weight: 600;
}

.drawer nav a small {
  color: var(--c-text-subtle);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

html:not([lang="ja"]) .drawer nav a small {
  display: none;
}

.drawer nav a[aria-current="page"] {
  color: var(--c-gold-soft);
}

.drawer .drawer-cta {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}

.drawer .drawer-cta .ui-btn {
  width: 100%;
}

.lang-switch-mobile {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 6px;
  margin-top: 24px;
}

.lang-switch-mobile button {
  border: 1px solid var(--c-line);
  text-align: center;
}

.lang-switch-mobile button[aria-selected="true"] {
  border-color: var(--c-gold-line);
  color: var(--c-gold-soft);
}

@media (min-width: 1024px) {
  .drawer {
    display: none;
  }
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--c-line);
  background: #070708;
  padding: clamp(56px, 8vw, 88px) 0 32px;
  font-size: 0.875rem;
}

.footer-grid {
  display: grid;
  gap: 40px;
}

@media (min-width: 720px) {
  .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .footer-grid {
    grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr));
    gap: 48px;
  }
}

.footer-brand p {
  margin: 16px 0 20px;
  max-width: 26em;
  color: var(--c-text-muted);
  line-height: 1.8;
}

.footer-brand .mail {
  display: inline-block;
  padding: 8px 0;
  color: var(--c-gold-soft);
  font-weight: 600;
}

/* Legacy per-page breadcrumbs: give the links a comfortable tap height. */
main .breadcrumb a {
  display: inline-block;
  padding: 8px 0;
}

.footer-col h2 {
  margin: 0 0 16px;
  color: var(--c-text-subtle);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.footer-col ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 2px;
}

.footer-col a {
  display: inline-block;
  padding: 6px 0;
  color: var(--c-text-muted);
  transition: color 0.2s var(--ease);
}

.footer-col a:hover {
  color: var(--c-text-strong);
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--c-line);
  color: var(--c-text-subtle);
  font-size: 0.8rem;
}

.footer-bottom nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
}

.footer-bottom a {
  padding: 6px 0;
  color: var(--c-text-muted);
}

.footer-bottom a:hover {
  color: var(--c-text-strong);
}

/* ---------- Breadcrumb (subpages) ---------- */

.ui-breadcrumb {
  margin: 0 0 24px;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--c-text-subtle);
  font-size: 0.8rem;
}

.ui-breadcrumb li + li::before {
  content: "/";
  margin-right: 6px;
  color: var(--c-line-strong);
}

.ui-breadcrumb a:hover {
  color: var(--c-text-strong);
}

/* ---------- Scroll reveal ---------- */

.js [data-reveal] {
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity 0.7s var(--ease),
    transform 0.7s var(--ease);
}

.js [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

/* Safety net: if site.js never runs, revealed content still appears. */
@keyframes reveal-fallback {
  to {
    opacity: 1;
    transform: none;
  }
}

.js [data-reveal]:not(.is-visible) {
  animation: reveal-fallback 0.01s 2.5s forwards;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .js [data-reveal] {
    opacity: 1;
    transform: none;
  }
}
