/* SEAGEM — shared stylesheet */

/* Self-hosted fonts (SIL OFL). Google Fonts is unreachable in mainland China. */
@font-face { font-family: "Bricolage Grotesque"; font-weight: 600; font-style: normal; font-display: swap; src: url("../fonts/bricolage-grotesque-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Bricolage Grotesque"; font-weight: 700; font-style: normal; font-display: swap; src: url("../fonts/bricolage-grotesque-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-style: normal; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }

:root {
  color-scheme: light;
  --ink: #0F2D3F;        /* deep sea */
  --tide: #4C7A8C;       /* mid water */
  --glass: #BFE0D6;      /* sea glass */
  --foam: #F5F8F7;       /* background */
  --pearl: #E3EAEC;      /* rules, fills */
  --gem: #5B3FD6;        /* amethyst accent */
  --gem-dark: #4630B0;
  --white: #FFFFFF;

  --f-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --f-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;

  /* modular scale ~1.25 */
  --t-sm: 0.875rem;
  --t-base: 1.0625rem;
  --t-md: 1.3rem;
  --t-lg: 1.75rem;
  --t-xl: clamp(2.1rem, 4vw, 3rem);
  --t-xxl: clamp(2.8rem, 7vw, 5.6rem);

  --wrap: 1200px;
  --gutter: clamp(1.25rem, 4vw, 3rem);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--f-body);
  font-size: var(--t-base);
  line-height: 1.6;
  color: var(--ink);
  background: var(--foam);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: rgba(91, 63, 214, 0.15);
  overflow-wrap: break-word;
}
body.nav-locked { overflow: hidden; }

img, svg { display: block; max-width: 100%; }
a { color: inherit; }
p { margin: 0 0 1em; max-width: 68ch; }

h1, h2, h3 {
  font-family: var(--f-display);
  font-weight: 600;
  text-wrap: balance;
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0 0 0.5em;
}
h1 { font-size: var(--t-xxl); font-weight: 700; letter-spacing: -0.035em; }
h2 { font-size: var(--t-xl); }
h3 { font-size: var(--t-md); letter-spacing: -0.01em; }

:focus-visible { outline: 3px solid var(--gem); outline-offset: 3px; border-radius: 2px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--white); padding: .6rem 1rem; z-index: 100; }
.skip:focus { left: 1rem; top: 1rem; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(245, 248, 247, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--pearl);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; font-family: var(--f-display); font-weight: 700; font-size: 1.35rem; letter-spacing: 0.02em; }
.brand svg { width: 32px; height: 32px; }

.nav { display: flex; align-items: center; gap: 2rem; }
.nav ul { display: flex; gap: 1.75rem; list-style: none; margin: 0; padding: 0; }
.nav a { text-decoration: none; font-size: .95rem; padding: .35rem 0; border-bottom: 2px solid transparent; }
.nav a:hover { border-color: var(--glass); }
.nav a[aria-current="page"] { border-color: var(--gem); }
.nav-toggle {
  display: none; align-items: center; gap: .55rem;
  min-height: 44px; padding: 0 .9rem;
  background: none; border: 1px solid var(--ink); border-radius: 999px;
  font: 600 .95rem var(--f-body); color: var(--ink); cursor: pointer;
}
.nav-toggle .bars { position: relative; width: 16px; height: 10px; }
.nav-toggle .bars::before, .nav-toggle .bars::after {
  content: ""; position: absolute; left: 0; right: 0; height: 2px; background: currentColor; border-radius: 2px;
  transition: transform .2s ease, top .2s ease;
}
.nav-toggle .bars::before { top: 0; }
.nav-toggle .bars::after { top: 8px; }
.nav-toggle[aria-expanded="true"] .bars::before { top: 4px; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .bars::after { top: 4px; transform: rotate(-45deg); }

@media (max-width: 920px) {
  /* backdrop-filter would trap the fixed menu inside the header; solid is also cheaper on phones */
  .site-header { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--foam); }
  .site-header .wrap { height: 64px; }
  .brand { font-size: 1.2rem; }
  .brand svg { width: 28px; height: 28px; }
  .nav-toggle { display: inline-flex; }
  /* Full-screen menu: big, thumb-friendly links */
  .nav {
    position: fixed; top: 64px; left: 0; right: 0; bottom: 0;
    background: var(--foam);
    flex-direction: column; align-items: stretch; justify-content: space-between; gap: 2rem;
    padding: 1rem var(--gutter) calc(1.5rem + env(safe-area-inset-bottom));
    overflow-y: auto; overscroll-behavior: contain;
    display: none;
  }
  .nav.open { display: flex; }
  .nav ul { flex-direction: column; gap: 0; }
  .nav li { border-bottom: 1px solid var(--pearl); }
  .nav ul a {
    display: flex; align-items: center; min-height: 60px;
    font-family: var(--f-display); font-weight: 600; font-size: 1.6rem; letter-spacing: -0.01em;
    border-bottom: 0; padding: .5rem 0;
  }
  .nav ul a[aria-current="page"] { color: var(--gem); }
  .nav .btn { justify-content: center; min-height: 52px; font-size: 1.05rem; }
}
@media (prefers-reduced-motion: reduce) { .nav-toggle .bars::before, .nav-toggle .bars::after { transition: none; } }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  font: 600 .98rem/1 var(--f-body);
  padding: .95rem 1.4rem; border-radius: 999px;
  text-decoration: none; cursor: pointer; border: 2px solid transparent;
  transition: background-color .15s ease, color .15s ease;
}
.btn-primary { background: var(--gem); color: var(--white); }
.btn-primary:hover { background: var(--gem-dark); }
.btn-ghost { border-color: var(--ink); color: var(--ink); background: transparent; }
.btn-ghost:hover { background: var(--ink); color: var(--foam); }
.btn-light { background: var(--foam); color: var(--ink); }
.btn-light:hover { background: var(--glass); }
.nav .btn { padding: .7rem 1.1rem; border-bottom: 2px solid transparent; }

/* ---------- sections ---------- */
.section { padding: clamp(4rem, 9vw, 7.5rem) 0; }
.section-tight { padding: clamp(3rem, 6vw, 4.5rem) 0; }
.section-dark { background: var(--ink); color: var(--foam); }
.section-glass { background: var(--glass); }
.lede { font-size: var(--t-md); line-height: 1.5; color: var(--tide); max-width: 52ch; }
.section-dark .lede { color: var(--glass); }

.split { display: grid; grid-template-columns: 5fr 7fr; gap: clamp(2rem, 6vw, 6rem); align-items: start; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; padding: clamp(4rem, 10vw, 8rem) 0 0; }
.hero h1 { max-width: 13ch; }
.hero .lede { margin-bottom: 2rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .9rem; }
.tide { width: 100%; height: clamp(220px, 32vw, 380px); margin-top: clamp(2rem, 5vw, 4rem); display: block; }

.page-hero { padding: clamp(4rem, 8vw, 6.5rem) 0 clamp(2.5rem, 5vw, 4rem); border-bottom: 1px solid var(--pearl); }
.page-hero h1 { font-size: clamp(2.4rem, 5.5vw, 4.2rem); max-width: 18ch; }

/* ---------- solution rows ---------- */
.rows { border-top: 1px solid var(--ink); margin-top: 2.5rem; }
.row {
  display: grid; grid-template-columns: 4fr 6fr 3fr; gap: 2rem;
  padding: 2rem 0; border-bottom: 1px solid var(--pearl);
  text-decoration: none; align-items: baseline;
}
.row h3 { font-size: var(--t-lg); margin: 0; }
.row p { margin: 0; color: var(--tide); }
.row .tags { font-size: var(--t-sm); color: var(--ink); }
a.row:hover h3 { color: var(--gem); }
@media (max-width: 860px) { .row { grid-template-columns: 1fr; gap: .6rem; } }

/* ---------- facts strip ---------- */
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; margin-top: 3rem; }
.fact { border-left: 2px solid var(--glass); padding-left: 1.25rem; }
.fact strong { display: block; font-family: var(--f-display); font-size: var(--t-xl); font-weight: 600; line-height: 1.1; color: var(--white); }
.fact span { color: var(--glass); font-size: .98rem; }
@media (max-width: 760px) { .facts { grid-template-columns: 1fr; } }

/* ---------- process (true sequence) ---------- */
.steps { list-style: none; margin: 2.5rem 0 0; padding: 0; counter-reset: step; display: grid; grid-template-columns: repeat(4, 1fr); gap: 2rem; }
.steps li { counter-increment: step; padding-top: 1.25rem; border-top: 2px solid var(--ink); }
.steps li::before { content: "Step " counter(step); display: block; font-size: var(--t-sm); color: var(--tide); margin-bottom: .4rem; }
.steps h3 { margin-bottom: .4rem; }
.steps p { color: var(--tide); font-size: .98rem; }
@media (max-width: 900px) { .steps { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .steps { grid-template-columns: 1fr; } }

/* ---------- detail blocks (solutions page) ---------- */
.detail { padding: clamp(3rem, 6vw, 5rem) 0; border-bottom: 1px solid var(--pearl); scroll-margin-top: 80px; }
.detail ul { margin: 0; padding-left: 1.1rem; }
.detail li { margin-bottom: .45rem; max-width: 60ch; }
.detail .modal { color: var(--tide); font-size: var(--t-sm); margin-top: 1.5rem; }

/* ---------- industries ---------- */
.ind-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0; margin-top: 2.5rem; border-top: 1px solid var(--ink); }
.ind { padding: 2rem 2rem 2rem 0; border-bottom: 1px solid var(--pearl); }
.ind:nth-child(even) { padding-left: 2rem; border-left: 1px solid var(--pearl); }
.ind p { color: var(--tide); margin: 0; }
@media (max-width: 760px) { .ind-grid { grid-template-columns: 1fr; } .ind:nth-child(even) { padding-left: 0; border-left: 0; } }

/* ---------- CTA band ---------- */
.cta-band { background: var(--gem); color: var(--white); padding: clamp(3.5rem, 7vw, 5.5rem) 0; }
.cta-band .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 2rem; }
.cta-band h2 { margin: 0; max-width: 20ch; }
.cta-band p { color: #E4DEFF; margin: .75rem 0 0; }

/* ---------- forms ---------- */
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.form .full { grid-column: 1 / -1; }
.field label { display: block; font-weight: 600; font-size: .95rem; margin-bottom: .4rem; }
.field input, .field select, .field textarea {
  width: 100%; font: inherit; color: var(--ink);
  padding: .8rem .9rem; background: var(--white);
  border: 1px solid #A9BAC1; border-radius: 8px;
}
.field textarea { min-height: 140px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 3px solid var(--gem); outline-offset: 0; border-color: var(--gem); }
.field .err { color: #B3261E; font-size: var(--t-sm); margin-top: .3rem; min-height: 1.2em; }
.field [aria-invalid="true"] { border-color: #B3261E; }
.form-status { grid-column: 1 / -1; padding: 1rem 1.2rem; border-radius: 8px; background: var(--glass); display: none; }
.form-status.show { display: block; }
@media (max-width: 640px) { .form { grid-template-columns: 1fr; } }
@media (max-width: 860px) { #contact-form { order: -1; } }

.contact-aside dl { margin: 2rem 0 0; }
.contact-aside dt { font-weight: 600; margin-top: 1.25rem; }
.contact-aside dd { margin: .2rem 0 0; color: var(--tide); }

.section-dark .ind { border-color: rgba(191, 224, 214, .25); }
.section-dark .ind p { color: var(--glass); }

/* ---------- footer ---------- */
.site-footer { background: var(--ink); color: var(--glass); padding: 4rem 0 2rem; font-size: .95rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 2rem; }
.site-footer h4 { color: var(--white); font: 600 1rem var(--f-body); margin: 0 0 .9rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: .5rem; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--white); text-decoration: underline; }
.site-footer .brand { color: var(--white); margin-bottom: 1rem; }
.footer-base { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid rgba(191, 224, 214, .25); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-grid > :first-child { grid-column: 1 / -1; } }

/* ---------- mobile sticky action bar ---------- */
.m-cta { display: none; }
@media (max-width: 920px) {
  .m-cta {
    display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    padding: .75rem var(--gutter) calc(.75rem + env(safe-area-inset-bottom));
    background: rgba(245, 248, 247, 0.96);
    border-top: 1px solid var(--pearl);
    transform: translateY(110%); transition: transform .25s ease;
  }
  .m-cta.show { transform: none; }
  .m-cta .btn { width: 100%; justify-content: center; min-height: 52px; font-size: 1.05rem; }
  body.has-m-cta .site-footer { padding-bottom: calc(6rem + env(safe-area-inset-bottom)); }
  body.nav-locked .m-cta { display: none; }
}
@media (prefers-reduced-motion: reduce) { .m-cta { transition: none; } }

/* ---------- phone layout ---------- */
.wrap { padding-left: max(var(--gutter), env(safe-area-inset-left)); padding-right: max(var(--gutter), env(safe-area-inset-right)); }

@media (max-width: 640px) {
  :root { --gutter: 1.25rem; --t-md: 1.15rem; --t-lg: 1.45rem; }
  h2 { font-size: clamp(1.75rem, 7.5vw, 2.1rem); }

  .section { padding: 3.5rem 0; }
  .section-tight { padding: 2.5rem 0; }
  .split { gap: 1.25rem; }

  .hero { padding-top: 2.75rem; }
  .hero h1 { font-size: clamp(2.6rem, 12vw, 3.4rem); max-width: none; }
  .hero .lede { margin-bottom: 1.75rem; }
  .hero-actions { flex-direction: column; gap: .75rem; }
  .hero-actions .btn, .cta-band .btn { width: 100%; justify-content: center; min-height: 52px; }
  .tide { height: 190px; margin-top: 2.25rem; }

  .page-hero { padding: 2.75rem 0 2rem; }
  .page-hero h1 { font-size: clamp(2.1rem, 9.5vw, 2.7rem); }

  .rows { margin-top: 1.75rem; }
  .row { padding: 1.4rem 0; gap: .4rem; }
  .row .tags { color: var(--gem); font-weight: 600; }

  /* Facts stay side by side: three short numbers read faster than a stack */
  .facts { grid-template-columns: repeat(3, 1fr); gap: .75rem; margin-top: 2rem; }
  .fact { padding-left: .75rem; }
  .fact strong { font-size: 1.55rem; }
  .fact span { font-size: .82rem; line-height: 1.35; display: block; margin-top: .25rem; }

  .steps { margin-top: 1.75rem; gap: 1.5rem; }
  .steps li { padding-top: 1rem; }

  .detail { padding: 2.75rem 0; scroll-margin-top: 72px; }
  .detail li { margin-bottom: .6rem; }

  .ind-grid { margin-top: 1.75rem; }
  .ind { padding: 1.4rem 0; }

  .cta-band { padding: 3rem 0; }
  .cta-band .wrap { gap: 1.5rem; }

  .form { gap: 1rem; }
  .field input, .field select, .field textarea { min-height: 50px; font-size: 1rem; }
  .field textarea { min-height: 130px; }
  .form .btn { width: 100%; justify-content: center; min-height: 52px; }

  .contact-aside h2 { font-size: 1.45rem; }
  .contact-aside dl { margin-top: 1rem; }

  .site-footer { padding-top: 3rem; }
  .site-footer a { display: inline-block; padding: .3rem 0; }
  .site-footer li { margin-bottom: .15rem; }
  .footer-base { margin-top: 2rem; flex-direction: column; gap: .4rem; }
}

/* Hover styles only where hover exists, so taps don't leave "stuck" states */
@media (hover: none) {
  .nav a:hover { border-color: transparent; }
  a.row:hover h3 { color: inherit; }
  .btn-ghost:hover { background: transparent; color: var(--ink); }
}
a.row:active h3 { color: var(--gem); }

/* Language control stays accessible on desktop and outside the mobile menu. */
html:lang(ja) .steps li::before { content: "ステップ " counter(step); }
html:lang(ko) .steps li::before { content: counter(step) "단계"; }
.site-header .wrap { gap: 1rem; }
.language-switch { order: 3; flex-shrink: 0; }
.language-switch select { min-height: 44px; max-width: 118px; padding: .45rem .6rem; border: 1px solid var(--pearl); border-radius: 8px; color: var(--ink); background: var(--foam); font: 500 .875rem var(--f-body); cursor: pointer; }
html:lang(ja) { --f-body: "IBM Plex Sans", "Noto Sans JP", "Yu Gothic", "Hiragino Kaku Gothic ProN", system-ui, sans-serif; --f-display: "Bricolage Grotesque", "Noto Sans JP", "Yu Gothic", sans-serif; }
html:lang(ko) { --f-body: "IBM Plex Sans", "Noto Sans KR", "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif; --f-display: "Bricolage Grotesque", "Noto Sans KR", "Malgun Gothic", sans-serif; word-break: keep-all; }
html:lang(ja) h1, html:lang(ko) h1 { line-height: 1.25; letter-spacing: -.02em; }
html:lang(ja) h2, html:lang(ko) h2, html:lang(ja) h3, html:lang(ko) h3 { line-height: 1.4; }
@media (min-width: 921px) and (max-width: 1200px) {
  .nav { gap: .8rem; } .nav ul { gap: .8rem; }
  .nav a { font-size: .85rem; }
  .site-header .wrap { gap: .65rem; }
}
@media (max-width: 920px) {
  .language-switch { order: 0; margin-left: auto; }
  .language-switch select { width: 99px; }
}
@media (max-width: 360px) {
  .site-header .wrap { gap: .4rem; }
  .language-switch select { width: 85px; padding: .4rem; }
  .nav-toggle { padding: 0 .65rem; }
}

/* Simplified Chinese typography and localized step labels. */
html:lang(zh) { --f-body: "IBM Plex Sans", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif; --f-display: "Bricolage Grotesque", "PingFang SC", "Microsoft YaHei", sans-serif; }
html:lang(zh) h1 { line-height: 1.25; letter-spacing: -.02em; }
html:lang(zh) h2, html:lang(zh) h3 { line-height: 1.4; }
html:lang(zh) .steps li::before { content: "第 " counter(step) " 步"; }
