@font-face {
  font-family: "Newsreader";
  src: url("/fonts/newsreader-500-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #f7f6fb;
  --surface: #ffffff;
  --ink: #1d1a3a;
  --ink-soft: #514b73;
  --muted: #6d64a3;
  --brand: #2b1f80;
  --accent: #4a36c4;
  --line: #ddd8ef;
  --sever: #203b3c;
  --sever-light: #c4f4df;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic", YuGothic, Meiryo, sans-serif;
  --content: 1120px;
  --gutter: 32px;
}

* { box-sizing: border-box; }

html {
  min-width: 280px;
  background: var(--paper);
  color: var(--ink);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

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

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.lab-page {
  width: min(100%, calc(var(--content) + var(--gutter) * 2));
  min-height: 100svh;
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  flex-direction: column;
}

.lab-header {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.melavern-mark {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 500;
  color: var(--brand);
}

.header-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
}

main { flex: 1; }

.lab-intro {
  padding: clamp(64px, 10vw, 112px) 0 clamp(56px, 8vw, 88px);
  max-width: 760px;
}


h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(52px, 8vw, 88px);
  font-weight: 500;
  line-height: 0.96;
  letter-spacing: -0.035em;
  color: var(--brand);
}

.featured { padding-bottom: clamp(72px, 10vw, 112px); }

.study-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.72fr);
  min-height: 390px;
  border: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
  transition: border-color 180ms ease, transform 180ms ease;
}

.study-link:hover {
  border-color: #aaa0d5;
  transform: translateY(-2px);
}

.study-link:focus-visible { outline-offset: 5px; }

.study-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: clamp(32px, 5vw, 60px);
}

.study-name {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(40px, 5vw, 62px);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: -0.025em;
  color: var(--ink);
}

.open-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin-top: auto;
  padding-top: 32px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
}

.prompt-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin-top: 14px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.study-visual {
  position: relative;
  min-height: 330px;
  overflow: hidden;
  background: var(--sever);
  color: var(--sever-light);
}

.study-visual::before,
.study-visual::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(196, 244, 223, 0.22);
  border-radius: 50%;
}

.study-visual::before { width: 330px; height: 330px; right: -90px; top: -80px; }
.study-visual::after { width: 220px; height: 220px; left: -90px; bottom: -100px; }

.blade {
  position: absolute;
  width: 2px;
  height: 122%;
  left: 51%;
  top: -11%;
  background: var(--sever-light);
  transform: rotate(38deg);
  box-shadow: 0 0 28px rgba(196, 244, 223, 0.36);
}

.blade::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: -7px;
  top: 44%;
  border: 1px solid var(--sever-light);
  transform: rotate(45deg);
  background: var(--sever);
}

.visual-word {
  position: absolute;
  left: 36px;
  bottom: 34px;
  font: 500 21px/1 Arial, Helvetica, sans-serif;
  letter-spacing: 0.23em;
}

.lab-footer {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: env(safe-area-inset-bottom, 0);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.lab-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink-soft);
}

.lab-footer a:hover { color: var(--brand); }

@media (max-width: 720px) {
  :root { --gutter: 20px; }
  .lab-header { min-height: 72px; }
  .melavern-mark { font-size: 24px; }
  .lab-intro { padding-top: 56px; }
  .study-link { grid-template-columns: 1fr; }
  .study-copy { min-height: 250px; }
  .study-visual { min-height: 280px; }
}

@media (max-width: 420px) {
  .lab-footer { align-items: flex-start; flex-direction: column-reverse; justify-content: center; gap: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .study-link { transition: none; }
  .study-link:hover { transform: none; }
}

@media (forced-colors: active) {
  .study-visual { border: 1px solid CanvasText; }
}
