/* ==========================================================================
   Research Lab — base.css
   Tokens / reset / typography
   ========================================================================== */

:root {
	--color-bg: #ffffff;
	--color-bg-sub: #f5f7fa;
	--color-bg-media: #f3f5f7; /* letterbox behind contained images */

	--color-primary: #102a43;
	--color-text: #172b4d;
	--color-muted: #6b778c;

	--color-accent: #15a6a6;
	--color-border: #e4e9ef;

	--container-width: 1200px;

	/* Derived tokens */
	--color-primary-deep: #0b1f33;
	--color-accent-strong: #0d7f7f; /* accessible accent for small text on white */
	--color-accent-soft: #e6f6f6;
	--color-border-strong: #cfd8e3;
	--color-on-dark: #ffffff;
	--color-on-dark-muted: #a9b8c8;
	--color-border-dark: rgba(255, 255, 255, 0.14);

	--font-sans: "Inter", "Noto Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", Meiryo, system-ui, sans-serif;
	--font-en: "Inter", "Helvetica Neue", Arial, "Noto Sans JP", sans-serif;

	/* Fluid type: mobile → desktop */
	--fs-h1: clamp(2.25rem, 1.55rem + 2.9vw, 3.75rem);   /* 36 → 60 */
	--fs-h2: clamp(1.75rem, 1.4rem + 1.5vw, 2.625rem);   /* 28 → 42 */
	--fs-h3: clamp(1.25rem, 1.12rem + 0.55vw, 1.625rem); /* 20 → 26 */
	--fs-body: clamp(1rem, 0.96rem + 0.18vw, 1.0625rem); /* 16 → 17 */
	--fs-lead: clamp(1.0625rem, 1rem + 0.3vw, 1.25rem);  /* 17 → 20 */
	--fs-small: 0.875rem;  /* 14 */
	--fs-xsmall: 0.8125rem; /* 13 */

	--lh-body: 1.9;
	--lh-heading: 1.45;

	--space-section: clamp(4.5rem, 3rem + 6.5vw, 9rem); /* ≈72 → 144 */
	--gutter: clamp(1.25rem, 0.8rem + 2vw, 2.5rem);
	--radius: 2px;
	--radius-md: 4px;

	--header-height: 76px;
	--shadow-soft: 0 1px 2px rgba(16, 42, 67, 0.04), 0 8px 24px rgba(16, 42, 67, 0.06);
	--ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

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

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

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

body {
	margin: 0;
	background: var(--color-bg);
	color: var(--color-text);
	font-family: var(--font-sans);
	font-size: var(--fs-body);
	line-height: var(--lh-body);
	letter-spacing: 0.02em;
	font-feature-settings: "palt" 0;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
	overflow-wrap: anywhere;
	word-break: normal;
	line-break: strict;
}

body.is-nav-open {
	overflow: hidden;
}

h1,
h2,
h3,
h4,
h5,
h6 {
	margin: 0;
	color: var(--color-primary);
	font-weight: 700;
	line-height: var(--lh-heading);
	letter-spacing: 0.02em;
	font-feature-settings: "palt" 1;
	word-break: auto-phrase;
}

p,
ul,
ol,
dl,
figure,
blockquote {
	margin: 0;
}

ul,
ol {
	padding: 0;
}

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

a {
	color: inherit;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.2em;
	transition: color 0.2s var(--ease), opacity 0.2s var(--ease);
}

strong,
b {
	font-weight: 700;
}

small {
	font-size: var(--fs-small);
}

hr {
	height: 1px;
	margin: 3rem 0;
	border: 0;
	background: var(--color-border);
}

button,
input,
select,
textarea {
	font: inherit;
	color: inherit;
	letter-spacing: inherit;
}

button {
	cursor: pointer;
}

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

::selection {
	background: var(--color-accent-soft);
	color: var(--color-primary);
}

/* Accessibility helpers ---------------------------------------------------- */

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.skip-link:focus {
	position: fixed !important;
	top: 12px;
	left: 12px;
	z-index: 1000;
	width: auto;
	height: auto;
	margin: 0;
	padding: 12px 20px;
	clip: auto;
	clip-path: none;
	background: var(--color-primary);
	color: #fff;
	font-size: var(--fs-small);
	text-decoration: none;
}

.site-main:focus {
	outline: none;
}

/* Icons ------------------------------------------------------------------- */

.icon {
	display: inline-block;
	flex-shrink: 0;
	width: 1.25em;
	height: 1.25em;
	vertical-align: middle;
}

/* Line-break utilities ---------------------------------------------------- */

.u-br-md,
.u-br-lg {
	display: none;
}

@media (min-width: 768px) {
	.u-br-sm {
		display: none;
	}
}

@media (min-width: 768px) {
	.u-br-md {
		display: inline;
	}
}

@media (min-width: 1024px) {
	.u-br-lg {
		display: inline;
	}
}

.u-nowrap {
	white-space: nowrap;
}

/*
 * Meaning-unit phrase: kept on one line from tablet up (paired with
 * .u-br-md), wraps naturally on mobile.
 */
@media (min-width: 768px) {
	.u-phrase {
		display: inline-block;
	}
}
