/* ============================================
   Three Plus Six Labs — Shared Stylesheet
   Visual sibling of TPS main site, scaled down
   for an experimental working space.
   ============================================ */

/* Google Fonts: Jost (online fallback for Futura) + Noto Sans JP (Japanese).
   threeplussix-brand-os /DESIGN.md typography.web_loading_rule, DL-022. */
@import url('https://fonts.googleapis.com/css2?family=Jost:wght@400;500;600;700&family=Noto+Sans+JP:wght@400;500;700&display=swap');

/* ============================================
   USAGE RULES (must follow)
   The canon is threeplussix-brand-os /DESIGN.md
   output_contexts.lab (DL-022). Agents read
   profiles/lab_tool.md there. If this file and the
   canon disagree, the canon wins: fix this file.
   1) PAPER: paper surface (never pure white), ink text.
   2) Accent: one per page. --color-accent is navy for
      emphasis words. A tool page may switch it to
      terracotta for large text and marks only.
   3) Japanese is Noto Sans JP. No Zen Kaku Gothic New,
      no mincho / serif, no Chinese-locale font (DL-021).
   4) Lobby (index.html) and about.html: hard minimal.
      No --radius-tool, no --font-mono.
   5) Tools may use radius and mono for usability only.
   ============================================ */

:root {
  /* === Brand tokens (threeplussix-brand-os /DESIGN.md colors, DL-022) === */
  --color-bg: #F7F5F2;          /* paper */
  --color-text: #0A0A0A;        /* ink */
  --color-text-inverse: #FFFFFF; /* white */
  --color-muted: #6C6E72;       /* gray-500, 4.69:1 on paper */
  --color-line: #E8E6E1;        /* gray-100 */
  --color-line-strong: #0A0A0A; /* ink */
  --color-accent: #1A3A5C;      /* navy, 10.70:1 on paper (replaces #7B2D26) */
  --color-hover: #3A3C3F;       /* gray-700 */

  /* typography.web_priority.mixed. No generic family before Noto Sans JP. */
  --font-primary: "TPS Futura", "Futura", "Jost", "Noto Sans JP", "Yu Gothic", "M PLUS 2", sans-serif;
  --font-jp: "TPS Futura", "Futura", "Jost", "Noto Sans JP", "Yu Gothic", "M PLUS 2", sans-serif;

  --transition-base: 300ms cubic-bezier(0.2, 0.8, 0.2, 1);

  /* Type scale — Labs caps at --fs-3xl */
  --fs-xs: 11px;
  --fs-sm: 13px;
  --fs-base: 15px;
  --fs-md: 17px;
  --fs-lg: 21px;
  --fs-xl: 28px;
  --fs-2xl: 40px;
  --fs-3xl: 56px;

  /* Spacing — Labs caps at --space-8 */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;
  --space-6: 48px;
  --space-7: 64px;
  --space-8: 96px;

  /* === EXTEND for Labs === */
  --font-mono: "JetBrains Mono", "SF Mono", "Menlo", "Consolas", monospace;
  --color-surface: #F7F5F2;      /* paper: tool areas are set off by a line, not a fill */
  --color-surface-line: #E8E6E1; /* gray-100 */

  /* === DEPART from TPS === */
  --max-width: 1200px;
  --max-width-narrow: 720px;
  --max-width-tool: 880px;
  --gutter: 48px;
  --gutter-mobile: 24px;
  --radius-tool: 4px;
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::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-size: var(--fs-base);
  font-weight: 400;
  line-height: 1.7;
  color: var(--color-text);
  background: var(--color-bg);
}

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

a {
  color: inherit;
  text-decoration: none;
  transition: opacity var(--transition-base);
}
a:hover { opacity: 0.6; }

button {
  font-family: inherit;
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
}

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

:focus-visible {
  outline: 2px solid var(--color-text);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-primary), var(--font-jp);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.display-lg {
  font-size: clamp(40px, 7vw, 80px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.03em;
}

.display-md {
  font-size: clamp(28px, 4.5vw, 56px);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.025em;
}

.heading-md {
  font-size: clamp(20px, 2vw, 28px);
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.eyebrow {
  font-family: var(--font-primary);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.eyebrow-muted {
  font-family: var(--font-primary);
  font-size: var(--fs-xs);
  font-weight: 400;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--color-muted);
}

p {
  font-size: var(--fs-md);
  line-height: 1.85;
  margin-bottom: var(--space-4);
}

p.lead {
  font-size: clamp(17px, 1.5vw, 21px);
  line-height: 1.7;
}

strong { font-weight: 700; }

.muted { color: var(--color-muted); }

/* ============================================
   LAYOUT
   ============================================ */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.container-narrow {
  max-width: var(--max-width-narrow);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.container-tool {
  max-width: var(--max-width-tool);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

section {
  padding: var(--space-8) 0;
}

.section-sm {
  padding: var(--space-6) 0;
}

.divider {
  border-top: 1px solid var(--color-text);
  width: 100%;
}

.divider-thin {
  border-top: 1px solid var(--color-line);
  width: 100%;
}

/* ============================================
   HEADER
   ============================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: var(--space-3) var(--gutter);
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-line);
}

.site-header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: var(--max-width);
  margin: 0 auto;
}

.site-brand {
  font-family: var(--font-primary);
  font-size: var(--fs-sm);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.site-brand .brand-mark {
  color: inherit; /* structural label, not an accent (ES-05, DL-022) */
}

.site-nav {
  display: flex;
  gap: var(--space-5);
}

.site-nav a {
  font-family: var(--font-primary);
  font-size: var(--fs-sm);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.site-nav a[aria-current="page"] {
  border-bottom: 1px solid var(--color-text);
  padding-bottom: 2px;
}

.back-to-main {
  font-family: var(--font-primary);
  font-size: var(--fs-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-muted);
  border: 1px solid var(--color-line);
  padding: 4px 10px;
  margin-left: var(--space-3);
  transition: color var(--transition-base), border-color var(--transition-base);
}
.back-to-main:hover {
  color: var(--color-text);
  border-color: var(--color-text);
  opacity: 1;
}

/* ============================================
   HERO (lobby-only)
   ============================================ */
.hero {
  /* 上下だけを決める。左右は同じ要素の .container の余白（--gutter）に任せる。 */
  padding-top: var(--space-8);
  padding-bottom: var(--space-7);
  border-bottom: 1px solid var(--color-text);
}

.hero-eyebrow {
  margin-bottom: var(--space-5);
}

.hero-title {
  font-family: var(--font-primary), var(--font-jp);
  font-size: clamp(40px, 7vw, 80px);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: -0.03em;
  max-width: 12em;
}

/* 見出しは文節の途中で折り返さない。幅が足りないときは文節の切れ目で折る。 */
.hero-phrase {
  display: inline-block;
}

.hero-lead {
  font-family: var(--font-jp);
  margin-top: var(--space-5);
  max-width: 38em;
  font-size: var(--fs-md);
  line-height: 1.85;
  color: var(--color-text);
}

/* ============================================
   EXPERIMENT CARDS (lobby)
   ============================================ */
.experiments {
  display: grid;
  gap: 0;
  margin-top: var(--space-6);
}

.experiment-card {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "title  status"
    "desc   desc"
    "meta   meta";
  gap: var(--space-3) var(--space-4);
  align-items: start;
  padding: var(--space-5) 0;
  border-top: 1px solid var(--color-text);
  transition: opacity var(--transition-base);
}

.experiment-card:last-child {
  border-bottom: 1px solid var(--color-text);
}

.experiment-card-title {
  grid-area: title;
  font-family: var(--font-primary), var(--font-jp);
  font-size: clamp(22px, 2.5vw, 32px);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.experiment-card-title a {
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition-base);
}

.experiment-card:hover .experiment-card-title a {
  border-bottom-color: var(--color-text);
}

.experiment-card-desc {
  grid-area: desc;
  font-family: var(--font-jp);
  font-size: var(--fs-base);
  line-height: 1.75;
  color: var(--color-text);
  max-width: 50em;
}

.experiment-card-meta {
  grid-area: meta;
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  font-family: var(--font-primary);
  font-size: var(--fs-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-muted);
}

/* ============================================
   STATUS BADGES
   ============================================ */
.status {
  font-family: var(--font-primary);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 3px 10px;
  white-space: nowrap;
  display: inline-block;
}

.status-alpha,
.status-beta,
.status-stable,
.status-sunset {
  /* Text in a 1px ink border; no color coding (DL-022, ES-05). */
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-line-strong);
}

.experiment-card .status {
  grid-area: status;
  align-self: start;
}

/* ============================================
   EDITORIAL (about.html)
   ============================================ */
.editorial {
  max-width: var(--max-width-narrow);
  margin: 0 auto;
}

.editorial h1 {
  font-family: var(--font-primary), var(--font-jp);
  font-size: clamp(32px, 4.5vw, 56px);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.025em;
  margin-bottom: var(--space-6);
}

.editorial h2 {
  font-size: clamp(20px, 2vw, 28px);
  font-weight: 500;
  margin-top: var(--space-7);
  margin-bottom: var(--space-4);
}

.editorial p {
  font-family: var(--font-jp);
  font-size: var(--fs-md);
  line-height: 1.95;
  margin-bottom: var(--space-4);
}

.editorial ul {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-5);
}

.editorial ul li {
  position: relative;
  padding-left: var(--space-4);
  margin-bottom: var(--space-3);
  line-height: 1.85;
  font-family: var(--font-jp);
}

.editorial ul li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--color-muted);
}

/* ============================================
   TOOL SURFACE (tool-only utilities)
   Use ONLY inside tool directories (ltv-simulator, etc.)
   Do NOT use in lobby (index.html) or about.html.
   ============================================ */
.tool-surface {
  background: var(--color-surface);
  border: 1px solid var(--color-surface-line);
  border-radius: var(--radius-tool);
  padding: var(--space-5);
}

.tool-num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.tool-input {
  font-family: var(--font-mono);
  font-size: var(--fs-md);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-tool);
  background: var(--color-bg);
  width: 100%;
  transition: border-color var(--transition-base);
}

.tool-input:focus {
  outline: none;
  border-color: var(--color-text);
}

.tool-label {
  display: block;
  font-family: var(--font-primary);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: var(--space-2);
}

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
  border-top: 1px solid var(--color-text);
  padding: var(--space-6) var(--gutter) var(--space-4);
}

.site-footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  font-family: var(--font-primary);
  font-size: var(--fs-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.site-footer a:hover { color: var(--color-text); opacity: 1; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  :root {
    --gutter: var(--gutter-mobile);
    --space-8: 64px;
    --space-7: 48px;
  }

  .site-header {
    padding: var(--space-3) var(--gutter);
  }

  .site-nav {
    gap: var(--space-3);
  }

  .experiment-card {
    grid-template-columns: 1fr;
    grid-template-areas:
      "status"
      "title"
      "desc"
      "meta";
  }

  .experiment-card .status { justify-self: start; }

  .site-footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ============================================
   UTILITIES
   ============================================ */
.mt-3 { margin-top: var(--space-3); }
.mt-5 { margin-top: var(--space-5); }
.mt-7 { margin-top: var(--space-7); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-7 { margin-bottom: var(--space-7); }

.hidden { display: none; }
