/* ============================================================
   Morphyca — Brand site stylesheet
   Design: Bauhaus / minimal / architectural with refined detail
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@200;300;400;500&family=JetBrains+Mono:wght@400&family=Noto+Sans+JP:wght@300;400;500&display=swap');

:root {
  --bg: #FAFAFA;
  --bg-alt: #F2F2F0;
  --bg-dark: #111111;
  --text: #111111;
  --text-on-dark: #FAFAFA;
  --text-secondary: #6B6B6B;
  --text-muted: #9A9A9A;
  --accent: #5C7A8A;
  --border: #E4E4E4;
  --border-strong: #C7C7C7;

  --max-width: 1080px;
  --content-width: 720px;

  --font-jp: 'Noto Sans JP', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-en: 'Inter', 'Noto Sans JP', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-jp);
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.85;
  color: var(--text);
  background-color: var(--bg);
  letter-spacing: 0.015em;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4 {
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.4;
}

p { margin-bottom: 1.25rem; }
p:last-child { margin-bottom: 0; }

p.lead {
  font-size: 1.0625rem;
  color: var(--text);
  margin-bottom: 1.5rem;
}

a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.25s var(--ease);
}

a:hover { color: var(--accent); }

ul, ol { padding-left: 1.25rem; margin-bottom: 1.25rem; }
li { margin-bottom: 0.4rem; }

strong { font-weight: 500; }

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 4rem 0;
}

/* ============================================================
   Layout
   ============================================================ */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
  width: 100%;
}

.container--narrow {
  max-width: var(--content-width);
}

main {
  flex: 1;
}

/* ============================================================
   Site Header
   ============================================================ */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: rgba(250, 250, 250, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease);
}

.site-header.is-scrolled {
  border-bottom-color: var(--border);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
}

.brand {
  font-family: var(--font-en);
  font-weight: 500;
  font-size: 0.9375rem;
  letter-spacing: 0.18em;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.brand:hover { color: var(--text); }

.brand::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--text);
  border-radius: 50%;
  display: inline-block;
}

.nav {
  display: flex;
  gap: 2.5rem;
}

.nav a {
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-family: var(--font-en);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  position: relative;
}

.nav a::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 1px;
  background: var(--text);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s var(--ease);
}

.nav a:hover {
  color: var(--text);
}

.nav a:hover::after,
.nav a.active::after {
  transform: scaleX(1);
  transform-origin: left;
}

@media (max-width: 640px) {
  .nav { gap: 1.25rem; }
  .nav a { font-size: 0.75rem; letter-spacing: 0.08em; }
}

/* ============================================================
   Hero
   ============================================================ */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  padding: 8rem 0 4rem;
}

.hero .container {
  position: relative;
}

.hero__eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-bottom: 2.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.hero__eyebrow::before {
  content: '';
  width: 32px;
  height: 1px;
  background: var(--text-secondary);
  display: inline-block;
}

.hero__wordmark {
  font-family: var(--font-en);
  font-weight: 200;
  font-size: clamp(3rem, 9vw, 6.5rem);
  letter-spacing: 0.04em;
  line-height: 1;
  color: var(--text);
  margin-bottom: 2rem;
}

.hero__tagline-en {
  font-family: var(--font-en);
  font-weight: 300;
  font-size: clamp(1rem, 1.6vw, 1.25rem);
  color: var(--text);
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
}

.hero__tagline-jp {
  font-size: 1rem;
  color: var(--text-secondary);
  letter-spacing: 0.12em;
  margin-bottom: 0;
}

.hero__scroll {
  position: absolute;
  bottom: 2rem;
  left: 2rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.hero__scroll::after {
  content: '';
  width: 1px;
  height: 32px;
  background: var(--text-muted);
  display: inline-block;
  animation: scrollLine 2s var(--ease) infinite;
}

@keyframes scrollLine {
  0%   { transform: scaleY(0); transform-origin: top; }
  50%  { transform: scaleY(1); transform-origin: top; }
  51%  { transform: scaleY(1); transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

@media (max-width: 640px) {
  .hero { min-height: 90vh; padding: 6rem 0 4rem; }
  .hero__scroll { display: none; }
}

/* ============================================================
   Sections (numbered, asymmetric)
   ============================================================ */
.section {
  padding: 7rem 0;
  border-top: 1px solid var(--border);
  position: relative;
}

.section:first-of-type { border-top: 1px solid var(--border); }

.section--alt {
  background: var(--bg-alt);
}

.section--dark {
  background: var(--bg-dark);
  color: var(--text-on-dark);
}

.section--dark .section__num,
.section--dark .section__label {
  color: rgba(250,250,250,0.55);
}

.section--dark .section__title { color: var(--text-on-dark); }
.section--dark p { color: rgba(250,250,250,0.85); }
.section--dark a { color: var(--text-on-dark); }
.section--dark a:hover { color: var(--accent); }
.section--dark .next-link { border-bottom-color: rgba(250,250,250,0.5); }

.section__grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 4rem;
}

.section__heading {
  position: relative;
}

.section__num {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.5rem;
}

.section__label {
  font-family: var(--font-en);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 0;
}

.section__title {
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0.02em;
  margin-bottom: 2rem;
  color: var(--text);
}

.section__body > p,
.section__body > ul,
.section__body > div {
  max-width: 640px;
}

@media (max-width: 880px) {
  .section { padding: 5rem 0; }
  .section__grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .section__heading {
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
  }
  .section--dark .section__heading { border-bottom-color: rgba(255,255,255,0.1); }
}

/* ============================================================
   Components
   ============================================================ */

/* Definition list */
.dl-clean {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 1rem 2rem;
  margin: 1.5rem 0;
}

.dl-clean dt {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
  padding-top: 0.25rem;
}

.dl-clean dd { color: var(--text); }

@media (max-width: 640px) {
  .dl-clean {
    grid-template-columns: 1fr;
    gap: 0.25rem 0;
  }
  .dl-clean dt { margin-top: 1rem; }
  .dl-clean dt:first-child { margin-top: 0; }
}

/* Capability list (numbered features) */
.capabilities {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
}

.section--dark .capabilities { border-top-color: rgba(255,255,255,0.1); }

.capabilities li {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 2rem;
  align-items: baseline;
  margin: 0;
  transition: padding-left 0.3s var(--ease);
}

.section--dark .capabilities li { border-bottom-color: rgba(255,255,255,0.1); }

.capabilities li:hover {
  padding-left: 0.5rem;
}

.capabilities__num {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  color: var(--text-muted);
}

.capabilities__name {
  font-weight: 500;
  font-size: 1.0625rem;
  margin-bottom: 0.25rem;
  display: block;
}

.capabilities__desc {
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.section--dark .capabilities__desc { color: rgba(250,250,250,0.6); }

@media (max-width: 640px) {
  .capabilities li {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
}

/* Product card grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.product-card {
  display: block;
  padding: 2rem;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
  position: relative;
  transition: border-color 0.3s var(--ease), transform 0.3s var(--ease);
}

.product-card::after {
  content: '↗';
  position: absolute;
  top: 1.5rem;
  right: 1.75rem;
  font-size: 1rem;
  color: var(--text-muted);
  transition: color 0.3s var(--ease), transform 0.3s var(--ease);
}

.product-card:hover {
  border-color: var(--text);
  color: var(--text);
}

.product-card:hover::after {
  color: var(--text);
  transform: translate(2px, -2px);
}

.product-card__category {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: block;
  margin-bottom: 1.5rem;
}

.product-card__name {
  font-size: 1.0625rem;
  font-weight: 500;
  margin: 0 0 0.5rem;
  letter-spacing: 0.01em;
}

.product-card__desc {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.7;
}

/* Next-link / inline cta */
.next-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 2rem;
  font-size: 0.875rem;
  letter-spacing: 0.08em;
  font-family: var(--font-en);
  text-transform: uppercase;
  color: var(--text);
  border-bottom: 1px solid var(--text);
  padding-bottom: 0.25rem;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease), gap 0.3s var(--ease);
}

.next-link:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
  gap: 0.875rem;
}

/* Contact info block */
.contact-info {
  margin-top: 2rem;
  padding: 2.5rem;
  background: #fff;
  border: 1px solid var(--border);
}

.section--dark .contact-info {
  background: rgba(255,255,255,0.03);
  border-color: rgba(255,255,255,0.12);
}

.contact-info dl {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 1rem 2rem;
}

.contact-info dt {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
  padding-top: 0.25rem;
}

.contact-info dd {
  color: var(--text);
}

.section--dark .contact-info dd { color: var(--text-on-dark); }
.section--dark .contact-info dt { color: rgba(250,250,250,0.5); }

@media (max-width: 640px) {
  .contact-info { padding: 1.5rem; }
  .contact-info dl {
    grid-template-columns: 1fr;
    gap: 0.25rem 0;
  }
  .contact-info dt { margin-top: 0.75rem; }
  .contact-info dt:first-child { margin-top: 0; }
}

/* Page header for legal/inner pages */
.page-header {
  padding: 10rem 0 4rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4rem;
}

.page-header .eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-bottom: 1.5rem;
}

.page-header h1 {
  font-size: clamp(1.875rem, 3.5vw, 2.5rem);
  font-weight: 400;
  letter-spacing: 0.01em;
  margin: 0;
}

/* Inner page content */
.prose {
  max-width: var(--content-width);
}

.prose h2 {
  font-size: 1.25rem;
  font-weight: 500;
  margin: 3rem 0 1rem;
}

.prose h2:first-child { margin-top: 0; }

.prose p {
  font-size: 1rem;
  color: var(--text);
}

.prose ul {
  margin: 1rem 0 1.5rem;
}

/* Tables */
table.legal-table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 0.9375rem;
}

table.legal-table th,
table.legal-table td {
  text-align: left;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

table.legal-table th {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 400;
  color: var(--text-secondary);
  width: 30%;
  padding-right: 2rem;
}

@media (max-width: 640px) {
  table.legal-table,
  table.legal-table tbody,
  table.legal-table tr,
  table.legal-table th,
  table.legal-table td { display: block; width: 100%; }
  table.legal-table th { border-bottom: none; padding-bottom: 0.25rem; }
  table.legal-table td { padding-top: 0.25rem; padding-bottom: 1rem; }
}

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 4rem 0 3rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.site-footer .container {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 3rem;
  align-items: start;
}

.footer-brand {
  font-family: var(--font-en);
  font-weight: 500;
  font-size: 0.9375rem;
  letter-spacing: 0.18em;
  color: var(--text);
  margin-bottom: 1.25rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.footer-brand::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--text);
  border-radius: 50%;
  display: inline-block;
}

.footer-meta {
  font-size: 0.8125rem;
  line-height: 1.8;
  color: var(--text-secondary);
}

.footer-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 2rem;
  justify-content: end;
  align-content: start;
}

.footer-nav a {
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-family: var(--font-en);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.footer-nav a:hover { color: var(--text); }

.footer-bottom {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  text-transform: uppercase;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem 2rem;
}

.footer-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.75rem;
}

.footer-legal a {
  font-family: var(--font-en);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: none;
  color: var(--text-secondary);
}

.footer-legal a:hover { color: var(--text); }

.footer-copyright {
  white-space: nowrap;
}

@media (max-width: 640px) {
  .site-footer .container {
    grid-template-columns: 1fr;
  }
  .footer-nav { grid-template-columns: 1fr 1fr; gap: 0.5rem 1rem; }
  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  .footer-legal { gap: 0.5rem 1.25rem; }
}

/* ============================================================
   Reveal-on-scroll
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
  will-change: opacity, transform;
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* Stagger via data-delay attribute */
.reveal[data-delay="1"] { transition-delay: 0.1s; }
.reveal[data-delay="2"] { transition-delay: 0.2s; }
.reveal[data-delay="3"] { transition-delay: 0.3s; }
.reveal[data-delay="4"] { transition-delay: 0.4s; }
.reveal[data-delay="5"] { transition-delay: 0.5s; }
.reveal[data-delay="6"] { transition-delay: 0.6s; }

/* Hero gets immediate fade-in */
.hero .reveal[data-delay="1"] { transition-delay: 0.15s; }
.hero .reveal[data-delay="2"] { transition-delay: 0.35s; }
.hero .reveal[data-delay="3"] { transition-delay: 0.55s; }
.hero .reveal[data-delay="4"] { transition-delay: 0.75s; }

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

/* ============================================================
   Contact Form
   ============================================================ */
.contact-form {
  margin-top: 1.5rem;
  padding: 2.5rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.contact-form__field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.contact-form__field label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(250, 250, 250, 0.55);
}

.contact-form input,
.contact-form textarea {
  font-family: var(--font-jp);
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--text-on-dark);
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.6rem 0;
  outline: none;
  transition: border-color 0.25s var(--ease);
  width: 100%;
  letter-spacing: 0.015em;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 0;
}

.contact-form textarea {
  resize: vertical;
  min-height: 8rem;
}

.contact-form input:focus,
.contact-form textarea:focus {
  border-bottom-color: var(--text-on-dark);
}

.contact-form input:-webkit-autofill,
.contact-form input:-webkit-autofill:hover,
.contact-form input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text-on-dark);
  -webkit-box-shadow: 0 0 0 1000px var(--bg-dark) inset;
  caret-color: var(--text-on-dark);
}

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

.contact-form__actions {
  margin-top: 0.5rem;
}

.contact-form__submit {
  font-family: var(--font-en);
  font-size: 0.8125rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-on-dark);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.5);
  padding: 0.95rem 2.5rem;
  cursor: pointer;
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease), color 0.3s var(--ease);
}

.contact-form__submit:hover:not(:disabled) {
  background: var(--text-on-dark);
  color: var(--bg-dark);
  border-color: var(--text-on-dark);
}

.contact-form__submit:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.contact-form__result {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: rgba(250, 250, 250, 0.65);
  margin: 0;
  min-height: 1.2em;
}

.contact-form__result[data-state="success"] { color: var(--text-on-dark); }
.contact-form__result[data-state="error"]   { color: #d99; }

@media (max-width: 640px) {
  .contact-form { padding: 1.5rem; gap: 1.5rem; }
}

/* Print */
@media print {
  .site-header, .site-footer { display: none; }
  body { color: #000; background: #fff; }
}
