/* =============================================================
   SmartCrab corporate site — shared styles (light only)
   Tokens: --bg #ffffff --surface #f1f6f9 --fg #000000 --muted #5d686f
   --border #e2eaee --accent(crab orange) #c84902 --accent-2 #f06405
   Radius 8/16/24, 1px hairlines, 8px baseline grid, container 1120px,
   reading width 720px. No web fonts, no external CDN.
   ============================================================= */

:root {
	color-scheme: light;
	--bg: #ffffff;
	--surface: #f1f6f9;
	--fg: #000000;
	/* WCAG-checked: #5d686f gives >=4.5:1 contrast against both --bg
	   (#ffffff, ~5.7:1) and --surface (#f1f6f9, ~5.3:1), so any small text
	   using --muted (badges, dates, table labels) passes AA on either
	   background while keeping the cool neutral tone. */
	--muted: #5d686f;
	--border: #e2eaee;
	--accent: #c84902;
	--accent-2: #f06405;
	--accent-text: #c84902;
	--accent-hover: #e05611;
	--accent-active: #9c3802;
	--wash: #f6ddc9;
	--sky: #46bdff;
	--surface-sky: #e6f3ff;
	--surface-2: #f1f6f9;

	--font-display:
		"Mazzard", system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial,
		"Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", sans-serif;
	--font-body: var(--font-display);
	--font-mono:
		ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas,
		"Liberation Mono", "Noto Sans Mono", monospace;

	--r-ctrl: 8px;
	--r-card: 16px;
	--r-hero: 24px;
	--hair: 1px solid var(--border);

	--container: 1120px;
	--read: 720px;
	--header-h: 68px;

	--shadow-1: 0 1px 2px rgba(20, 30, 40, 0.04);
	--shadow-2: 0 6px 22px rgba(20, 30, 40, 0.07);
}

* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

html {
	scroll-behavior: smooth;
}

body {
	background: var(--bg);
	color: var(--fg);
	font-family: var(--font-body);
	font-size: 16px;
	line-height: 1.7;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
}

img,
svg {
	max-width: 100%;
}
a {
	color: inherit;
}
button {
	font-family: inherit;
	cursor: pointer;
}

.wrap {
	width: 100%;
	max-width: var(--container);
	margin-inline: auto;
	padding-inline: 24px;
}

.skip-link {
	position: absolute;
	left: 12px;
	top: -48px;
	background: var(--fg);
	color: var(--bg);
	padding: 10px 16px;
	border-radius: var(--r-ctrl);
	z-index: 100;
	text-decoration: none;
	font-weight: 600;
	transition: top 0.15s;
}
.skip-link:focus {
	top: 12px;
}

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

/* --------------------------------------------------------------
   Header / nav
   -------------------------------------------------------------- */
.site-header {
	position: sticky;
	top: 0;
	z-index: 50;
	background: color-mix(in srgb, var(--bg) 88%, transparent);
	backdrop-filter: saturate(160%) blur(12px);
	-webkit-backdrop-filter: saturate(160%) blur(12px);
	border-bottom: var(--hair);
}
.nav {
	height: var(--header-h);
	display: flex;
	align-items: center;
	gap: 20px;
}
.brand {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	text-decoration: none;
	font-weight: 700;
	letter-spacing: -0.01em;
	color: var(--fg);
	white-space: nowrap;
}
.brand .mark {
	color: var(--accent-text);
	width: 30px;
	height: 30px;
	flex: none;
}

.nav-links {
	display: flex;
	align-items: center;
	gap: 4px;
	margin-left: 8px;
}
.nav-links a {
	position: relative;
	text-decoration: none;
	color: var(--fg);
	font-size: 15px;
	font-weight: 550;
	padding: 8px 12px;
	border-radius: var(--r-ctrl);
	letter-spacing: 0.01em;
	transition:
		background 0.15s,
		color 0.15s;
}
.nav-links a:hover {
	background: var(--surface);
}
.nav-links a[aria-current="page"] {
	color: var(--accent-text);
}

/* A small underline that lives under whichever nav link is current. Only the
   active link's indicator carries a `view-transition-name` (see below), so
   navigating between About and News morphs/slides this one shared element
   from its old position to its new one instead of just appearing. */
.nav-indicator {
	position: absolute;
	left: 12px;
	right: 12px;
	bottom: 4px;
	height: 2px;
	border-radius: 2px;
	background: transparent;
}
/* Named individually (not just `.nav-label`) so each link's label keeps a
   stable, unique view-transition-name across pages — required for the
   color crossfade in the View Transitions section below to morph the right
   pair instead of colliding with the other link's label. `inline-block` keeps
   the named element a proper box (a bare inline run can be an invalid view
   transition snapshot target if it ever wraps), though as a single word here
   it never wraps in practice. */
.nav-label {
	display: inline-block;
}
.nav-link-home .nav-label {
	view-transition-name: nav-label-home;
}
.nav-link-news .nav-label {
	view-transition-name: nav-label-news;
}
.nav-links a[aria-current="page"] .nav-indicator {
	background: var(--accent);
	view-transition-name: nav-indicator;
}

.header-actions {
	margin-left: auto;
	display: flex;
	align-items: center;
	gap: 10px;
}

.lang-switch {
	display: flex;
	align-items: center;
	gap: 2px;
	border: var(--hair);
	border-radius: 999px;
	padding: 3px;
	background: var(--surface);
}
.lang-switch a {
	text-decoration: none;
	color: var(--muted);
	font-family: var(--font-mono);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.02em;
	padding: 6px 11px;
	border-radius: 999px;
	transition:
		background 0.15s,
		color 0.15s;
}
.lang-switch a[aria-current="true"] {
	background: var(--bg);
	color: var(--fg);
	box-shadow: var(--shadow-1);
}
.lang-switch-mobile {
	display: none;
}

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	height: 44px;
	padding: 0 20px;
	border-radius: 999px;
	font-size: 15px;
	font-weight: 600;
	letter-spacing: 0.01em;
	text-decoration: none;
	border: var(--hair);
	background: var(--bg);
	color: var(--fg);
	transition:
		transform 0.06s ease,
		background 0.15s,
		border-color 0.15s,
		color 0.15s;
}
.btn:active {
	transform: translateY(1px);
}
.btn-primary {
	background: var(--accent);
	border-color: var(--accent);
	color: #fff;
}
.btn-primary:hover {
	background: var(--accent-hover);
	border-color: var(--accent-hover);
}
.btn-primary:active {
	background: var(--accent-active);
}
.btn-primary:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}
.btn-ghost:hover {
	background: var(--surface);
}

/* --------------------------------------------------------------
   Footer
   -------------------------------------------------------------- */
.site-footer {
	border-top: var(--hair);
	margin-top: 80px;
	padding: 56px 0 48px;
	background: var(--surface);
}
.footer-grid {
	display: grid;
	grid-template-columns: 1.6fr 1fr;
	gap: 32px;
}
.footer-grid h4 {
	font-size: 12px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--muted);
	margin-bottom: 14px;
}
.footer-grid .brand {
	display: inline-flex;
}

.footer-grid a {
	display: block;
	text-decoration: none;
	color: var(--fg);
	font-size: 14px;
	padding: 5px 0;
}
.footer-grid a:hover {
	color: var(--accent-text);
}
.footer-about p {
	color: var(--muted);
	font-size: 14px;
	max-width: 40ch;
	margin-top: 12px;
}
.footer-bottom {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	align-items: center;
	justify-content: space-between;
	border-top: var(--hair);
	margin-top: 40px;
	padding-top: 24px;
	font-size: 13px;
	color: var(--muted);
}
.site-footer .brand .mark {
	color: var(--muted);
}

.mono-label {
	font-family: var(--font-mono);
	font-size: 12px;
	letter-spacing: 0.02em;
	color: var(--muted);
}

@media (max-width: 860px) {
	.footer-grid {
		grid-template-columns: 1fr;
	}
}
@media (max-width: 520px) {
	.wrap {
		padding-inline: 18px;
	}
	.nav-links {
		gap: 0;
	}
	.nav-links a {
		padding: 8px 8px;
		font-size: 14px;
	}
}

/* --------------------------------------------------------------
   Hero (About / home)
   -------------------------------------------------------------- */
.hero {
	border-radius: var(--r-hero);
	background: linear-gradient(160deg, var(--wash), var(--surface) 65%);
	padding: clamp(40px, 7vw, 76px) clamp(24px, 6vw, 64px);
	margin: 40px 0 56px;
}
.hero .eyebrow {
	color: var(--accent-text);
}
.hero h1 {
	font-family: var(--font-display);
	font-size: clamp(40px, 6.4vw, 72px);
	line-height: 1.04;
	letter-spacing: -0.03em;
	font-weight: 700;
	margin: 16px 0 20px;
	max-width: 16ch;
	text-wrap: balance;
}
.hero p {
	font-size: clamp(16px, 2.2vw, 19px);
	color: var(--fg);
	max-width: 62ch;
	line-height: 1.75;
}

/* --------------------------------------------------------------
   About section
   -------------------------------------------------------------- */
.section {
	padding: 56px 0;
}
.section-head {
	margin-bottom: 28px;
}
.section-head h2 {
	font-family: var(--font-display);
	font-size: clamp(24px, 3.2vw, 32px);
	letter-spacing: -0.02em;
	font-weight: 700;
}
.about-copy {
	max-width: var(--read);
	display: grid;
	gap: 18px;
}
.about-copy p {
	font-size: 16.5px;
	line-height: 1.85;
	color: var(--fg);
}

.company-table-wrap {
	overflow-x: auto;
	margin-top: 8px;
}
.company-table {
	width: 100%;
	border-collapse: collapse;
	max-width: 720px;
}
.company-table th,
.company-table td {
	text-align: left;
	padding: 14px 16px;
	border-bottom: var(--hair);
	font-size: 15px;
	vertical-align: top;
}
.company-table th {
	width: 11em;
	color: var(--muted);
	font-weight: 600;
	white-space: nowrap;
}
.company-table tr:last-child th,
.company-table tr:last-child td {
	border-bottom: 0;
}

/* --------------------------------------------------------------
   NEWS cards (home preview + index grid)
   -------------------------------------------------------------- */
.news-card-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 24px;
}
.news-card {
	display: flex;
	flex-direction: column;
	border: var(--hair);
	border-radius: var(--r-card);
	padding: 24px;
	background: var(--bg);
	text-decoration: none;
	color: var(--fg);
	transition:
		box-shadow 0.2s,
		transform 0.2s,
		border-color 0.2s;
}
.news-card:hover {
	box-shadow: var(--shadow-2);
	transform: translateY(-3px);
	border-color: color-mix(in srgb, var(--accent) 22%, var(--border));
}
.news-card-thumb {
	width: 100%;
	/* The `<img>` carries HTML `width`/`height` attributes for CLS prevention
	   (see docs/CONTRACT.md); those set an explicit `height`, which blocks
	   `aspect-ratio` from ever resolving a dimension. `height: auto` releases
	   it so the 16:9 box below actually takes effect. */
	height: auto;
	aspect-ratio: 16 / 9;
	object-fit: cover;
	/* A 16:9 card thumbnail crops well over half of a square source image
	   away; bias toward the top so a top-anchored subject (a wordmark, a
	   face) survives the crop instead of being cut through the middle. */
	object-position: top;
	border-radius: var(--r-ctrl);
	margin-bottom: 16px;
}
.news-card time {
	font-family: var(--font-mono);
	font-size: 12.5px;
	color: var(--muted);
}
.news-card h3 {
	font-family: var(--font-display);
	font-size: 18px;
	line-height: 1.35;
	letter-spacing: -0.01em;
	font-weight: 700;
	margin: 10px 0 10px;
}
.news-card .excerpt {
	color: var(--muted);
	font-size: 14.5px;
	line-height: 1.65;
}
.news-card .badge,
.news-card .chip {
	margin-top: 12px;
	align-self: flex-start;
}

/* --------------------------------------------------------------
   Genre chip (news.genre) — same shape as .badge, accent-colored so
   it reads as CMS-authored metadata rather than a build-time notice.
   -------------------------------------------------------------- */
.chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-family: var(--font-mono);
	font-size: 11.5px;
	letter-spacing: 0.04em;
	border: var(--hair);
	border-radius: 999px;
	padding: 4px 11px;
	color: var(--accent-text);
	background: var(--wash);
}

.news-view-all {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin-top: 28px;
	font-weight: 600;
	color: var(--accent-text);
	text-decoration: none;
}
.news-view-all:hover {
	text-decoration: underline;
}

/* --------------------------------------------------------------
   Contact form
   -------------------------------------------------------------- */
.contact-card {
	border: var(--hair);
	border-radius: var(--r-hero);
	background: var(--surface);
	padding: clamp(28px, 5vw, 48px);
	display: grid;
	grid-template-columns: 1fr 1.2fr;
	gap: 40px;
}
.contact-intro p {
	color: var(--muted);
	margin-top: 10px;
	font-size: 15.5px;
	max-width: 36ch;
	line-height: 1.7;
}
.contact-form {
	display: grid;
	gap: 16px;
}
.form-field {
	display: grid;
	gap: 6px;
}
.form-field label {
	font-size: 13.5px;
	font-weight: 600;
	color: var(--fg);
}
.form-field input,
.form-field textarea {
	border: var(--hair);
	border-radius: var(--r-ctrl);
	padding: 12px 14px;
	font: inherit;
	font-size: 15px;
	background: var(--bg);
	color: var(--fg);
	resize: vertical;
}
.form-field textarea {
	min-height: 120px;
}
.form-field input:focus,
.form-field textarea:focus {
	outline: 0;
	border-color: var(--accent);
	box-shadow: 0 0 0 3px #fff3e6;
}
.field-error {
	color: var(--accent-text);
	font-size: 13px;
	font-weight: 600;
	min-height: 0;
}
.field-error:empty {
	display: none;
}
.form-honeypot {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}
.form-message {
	font-size: 14px;
	font-weight: 600;
	min-height: 20px;
}
.form-message[data-state="success"] {
	color: #1a7f37;
}
.form-message[data-state="error"] {
	color: var(--accent-text);
}

@media (max-width: 860px) {
	.news-card-grid {
		grid-template-columns: repeat(2, 1fr);
	}
	.contact-card {
		grid-template-columns: 1fr;
	}
}
@media (max-width: 560px) {
	.news-card-grid {
		grid-template-columns: 1fr;
	}
}

/* --------------------------------------------------------------
   NEWS index — masthead / featured / grid / pager
   -------------------------------------------------------------- */
.masthead {
	padding: 48px 0 32px;
}
.masthead h1 {
	font-family: var(--font-display);
	font-size: clamp(34px, 5.4vw, 56px);
	line-height: 1.06;
	letter-spacing: -0.025em;
	font-weight: 700;
	margin: 12px 0 14px;
}
.masthead p {
	color: var(--muted);
	font-size: clamp(15px, 2vw, 18px);
	max-width: 58ch;
}

/* Two-column layout: media bleeds edge-to-edge on the left, copy sits in a
   padded, wash-tinted column on the right (see the Tech Blog prototype's
   `.featured` for the reference shape). `.no-media` (no resolvable image)
   falls back to a single padded column. */
.featured {
	display: grid;
	grid-template-columns: 1.1fr 1fr;
	border: var(--hair);
	border-radius: var(--r-hero);
	overflow: hidden;
	background: var(--bg);
	text-decoration: none;
	color: var(--fg);
	margin-bottom: 40px;
	transition:
		box-shadow 0.2s,
		transform 0.2s;
}
.featured:hover {
	box-shadow: var(--shadow-2);
	transform: translateY(-2px);
}
.featured.no-media {
	grid-template-columns: 1fr;
}
.featured-media {
	position: relative;
	min-height: 260px;
	overflow: hidden;
	background: var(--surface);
}
.featured-thumb {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	/* Same top bias as .news-card-thumb — matters most on the mobile
	   single-column layout, where .featured-media gets a 16:9 aspect-ratio
	   crop instead of stretching to match .featured-body's height. */
	object-position: top;
}
.featured-body {
	padding: clamp(28px, 5vw, 44px);
	display: flex;
	flex-direction: column;
	justify-content: center;
	background: linear-gradient(160deg, var(--wash), var(--bg) 70%);
}
.featured time {
	font-family: var(--font-mono);
	font-size: 13px;
	color: var(--muted);
}
.featured h2 {
	font-family: var(--font-display);
	font-size: clamp(24px, 3.6vw, 36px);
	line-height: 1.18;
	letter-spacing: -0.02em;
	font-weight: 700;
	margin: 14px 0 14px;
}
.featured .excerpt {
	color: var(--fg);
	font-size: 16px;
}

.news-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 24px;
}

.pager {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin-top: 44px;
}
.pager a,
.pager span {
	min-width: 40px;
	height: 40px;
	padding: 0 12px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: var(--hair);
	border-radius: var(--r-ctrl);
	text-decoration: none;
	color: var(--fg);
	font-size: 14px;
	font-family: var(--font-mono);
}
.pager a:hover {
	background: var(--surface);
}
.pager .current {
	background: var(--fg);
	color: var(--bg);
	border-color: var(--fg);
}
.pager .disabled {
	color: var(--muted);
	pointer-events: none;
}

@media (max-width: 1000px) {
	.news-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}
@media (max-width: 760px) {
	.featured {
		grid-template-columns: 1fr;
	}
	/* In the single-column stack the media area no longer inherits its
	   height by stretching alongside .featured-body, so give it an explicit
	   aspect ratio instead. */
	.featured-media {
		aspect-ratio: 16 / 9;
		min-height: 0;
	}
}
@media (max-width: 560px) {
	.news-grid {
		grid-template-columns: 1fr;
	}
}

/* --------------------------------------------------------------
   Badge ("Japanese only" etc)
   -------------------------------------------------------------- */
.badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-family: var(--font-mono);
	font-size: 11.5px;
	letter-spacing: 0.04em;
	border: var(--hair);
	border-radius: 999px;
	padding: 4px 11px;
	color: var(--muted);
	background: var(--surface);
}

/* --------------------------------------------------------------
   NEWS item — breadcrumb / prose / related
   -------------------------------------------------------------- */
.crumb {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	color: var(--muted);
	margin: 28px 0 20px;
}
.crumb a {
	color: var(--muted);
	text-decoration: none;
}
.crumb a:hover {
	color: var(--accent-text);
}
.crumb .sep {
	opacity: 0.6;
}

.article-hero-image {
	width: 100%;
	/* Same fix as .news-card-thumb: release the `<img height>` attribute's
	   implicit height so aspect-ratio/max-height can actually govern it. */
	height: auto;
	aspect-ratio: 21 / 9;
	max-height: 420px;
	object-fit: cover;
	/* Same top bias as .news-card-thumb (see its comment) — a 21:9 crop of a
	   square source keeps only a thin vertical band; anchoring near the top
	   keeps a top-anchored subject in frame. */
	object-position: 50% 20%;
	border-radius: var(--r-hero);
	margin-bottom: 28px;
}
.article-hero h1 {
	font-family: var(--font-display);
	font-size: clamp(28px, 4.6vw, 46px);
	line-height: 1.14;
	letter-spacing: -0.02em;
	font-weight: 700;
	margin: 0 0 16px;
	max-width: 24ch;
}
.article-meta {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
	margin-bottom: 32px;
	padding-bottom: 24px;
	border-bottom: var(--hair);
	font-size: 14px;
	color: var(--muted);
}

.prose {
	max-width: var(--read);
	font-size: 17px;
}
.prose > p {
	margin: 0 0 20px;
	line-height: 1.9;
}
.prose h2 {
	font-family: var(--font-display);
	font-size: clamp(22px, 3vw, 27px);
	line-height: 1.25;
	letter-spacing: -0.02em;
	margin: 44px 0 16px;
}
.prose h2:first-child {
	margin-top: 0;
}
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
	font-family: var(--font-display);
	font-size: 19px;
	letter-spacing: -0.01em;
	margin: 30px 0 12px;
}
.prose ul,
.prose ol {
	margin: 0 0 20px;
	padding-left: 1.35em;
}
.prose li {
	margin-bottom: 8px;
	line-height: 1.85;
}
.prose li > p {
	margin: 0;
}
.prose li::marker {
	color: var(--muted);
}
.prose strong {
	font-weight: 700;
}
.prose blockquote {
	border-left: 3px solid var(--accent);
	padding: 4px 0 4px 18px;
	color: var(--muted);
	margin: 0 0 20px;
	font-style: italic;
}
.prose a.inline {
	color: var(--accent-text);
	text-decoration: underline;
	text-underline-offset: 3px;
}
.prose :not(pre) > code {
	font-family: var(--font-mono);
	font-size: 0.86em;
	background: var(--surface-2);
	border: var(--hair);
	border-radius: 6px;
	padding: 1.5px 6px;
	color: var(--fg);
}
.prose pre {
	margin: 0 0 24px;
	padding: 16px;
	overflow-x: auto;
	border: var(--hair);
	border-radius: 12px;
	background: var(--surface-2);
}
.prose pre code {
	font-family: var(--font-mono);
	font-size: 13.5px;
	line-height: 1.75;
	background: none;
	border: 0;
	padding: 0;
}
.prose img {
	max-width: 100%;
	height: auto;
	border-radius: 12px;
	margin: 0 0 20px;
}

/* Placeholder for richtext node kinds we don't have a real renderer for yet
   (see src/lib/richtext.ts) — deliberately visible rather than hidden, so a
   missing image/entity embed is obvious instead of silently disappearing. */
.rt-embed {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 96px;
	margin: 0 0 20px;
	border: 1px dashed var(--border);
	border-radius: 12px;
	background: var(--surface-2);
}
.rt-embed-label {
	font-size: 13px;
	color: var(--muted);
	font-family: var(--font-mono);
}
.rt-entity-link {
	border-bottom: 1px dotted var(--muted);
}

.related {
	border-top: var(--hair);
	margin-top: 56px;
	padding-top: 40px;
}
.related h2 {
	font-family: var(--font-display);
	font-size: 22px;
	letter-spacing: -0.01em;
	margin-bottom: 22px;
}
.related-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 20px;
}
.rel-card {
	border: var(--hair);
	border-radius: var(--r-card);
	padding: 20px;
	text-decoration: none;
	color: var(--fg);
	background: var(--bg);
	transition:
		box-shadow 0.2s,
		transform 0.2s;
}
.rel-card:hover {
	box-shadow: var(--shadow-2);
	transform: translateY(-2px);
}
.rel-card time {
	font-family: var(--font-mono);
	font-size: 12px;
	color: var(--muted);
}
.rel-card h3 {
	font-family: var(--font-display);
	font-size: 16px;
	line-height: 1.35;
	letter-spacing: -0.01em;
	margin-top: 8px;
}

.back-link {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin-top: 40px;
	text-decoration: none;
	color: var(--accent-text);
	font-weight: 600;
}
.back-link:hover {
	text-decoration: underline;
}

@media (max-width: 720px) {
	.related-grid {
		grid-template-columns: 1fr;
	}
	.prose {
		font-size: 16px;
	}
}

/* ---- View Transitions (cross-document MPA navigation) ---------------- */
/* Same-origin navigations crossfade; browsers without support (or with the
   feature disabled) fall back to instant navigation, so everything in this
   section is purely a progressive enhancement. Each NEWS thumbnail and
   headline carries a per-item `view-transition-name` (see
   newsImageTransitionName / newsTitleTransitionName in content.ts) matching
   the article's hero image and `<h1>`, which makes the card morph into the
   article on click. */
@view-transition {
	navigation: auto;
}

/* The header is identical on every page — naming it keeps it visually
   static during the transition instead of crossfading with the content. */
.site-header {
	view-transition-name: site-header;
}

/* The old (16:9 thumb) and new (21:9 hero) snapshots have different aspect
   ratios; letting each snapshot fill the morphing group with cover-fit
   avoids a visible stretch mid-flight. Scoped to the news-image
   view-transition-class so the root crossfade keeps its default behavior. */
::view-transition-old(.news-image),
::view-transition-new(.news-image) {
	height: 100%;
	object-fit: cover;
	overflow: hidden;
}

/* The main content region gets its own named group so nav clicks (Home <->
   News <-> an article) read as a deliberately designed transition instead of
   the default whole-page crossfade — header/footer aren't part of this
   group, so they stay put. Timings are intentionally quick (~200ms, easing
   matches --hair/--btn's existing cubic-bezier) so the whole transition
   comfortably fits inside ~350ms even with the image/title morphs running
   alongside it. */
#main {
	view-transition-name: site-main;
}

::view-transition-group(site-main) {
	animation-duration: 220ms;
	animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

::view-transition-old(site-main),
::view-transition-new(site-main) {
	animation-duration: 220ms;
	animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Default motion: a soft lift + fade. This is what plays whenever the nav
   direction couldn't be classified — same-level moves (pagination, the
   ja/en language switch) and any browser that supports view transitions but
   not the pageswap/pagereveal direction classifier below. */
@keyframes sc-main-out {
	to {
		opacity: 0;
		transform: translateY(-8px);
	}
}
@keyframes sc-main-in {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
}
::view-transition-old(site-main) {
	animation-name: sc-main-out;
}
::view-transition-new(site-main) {
	animation-name: sc-main-in;
}

/* Directional refinement: static/view-transitions.js classifies each
   navigation as "forward" (Home -> News -> an article, i.e. deeper into the
   site) or "back" (the reverse) via the pageswap/pagereveal events and adds
   that as a view transition type, which these rules key off of. Browsers
   without that support simply keep the default lift + fade above. */
@keyframes sc-main-out-forward {
	to {
		opacity: 0;
		transform: translateX(-18px);
	}
}
@keyframes sc-main-in-forward {
	from {
		opacity: 0;
		transform: translateX(18px);
	}
}
@keyframes sc-main-out-back {
	to {
		opacity: 0;
		transform: translateX(18px);
	}
}
@keyframes sc-main-in-back {
	from {
		opacity: 0;
		transform: translateX(-18px);
	}
}
:root:active-view-transition-type(forward)::view-transition-old(site-main) {
	animation-name: sc-main-out-forward;
}
:root:active-view-transition-type(forward)::view-transition-new(site-main) {
	animation-name: sc-main-in-forward;
}
:root:active-view-transition-type(back)::view-transition-old(site-main) {
	animation-name: sc-main-out-back;
}
:root:active-view-transition-type(back)::view-transition-new(site-main) {
	animation-name: sc-main-in-back;
}

/* nav-indicator gets its own timing: longer and springier than site-main's
   plain ease-out, so the underline reads as a deliberate little "hop"
   between About and News rather than following the page-content slide. */
::view-transition-group(nav-indicator) {
	animation-duration: 360ms;
	animation-timing-function: cubic-bezier(0.34, 1.35, 0.55, 1);
}

/* The UA default crossfades old/new (each fading through ~50% opacity
   mid-flight), which reads as the underline dimming as it moves. Freezing
   both at full opacity leaves the group's transform/size interpolation above
   as the only motion, so the underline stays solid throughout. `width`/
   `height: 100%` makes each snapshot fill the animated group box instead of
   keeping its own captured size, so old (About-width) and new (News-width)
   both stretch to match the group instead of one of them looking clipped or
   padded. `mix-blend-mode: normal` overrides the UA default of
   `plus-lighter`, which would additively blend the two overlapping (both
   opaque, same-color) snapshots into a blown-out color for the whole
   duration. */
::view-transition-old(nav-indicator),
::view-transition-new(nav-indicator) {
	animation: none;
	opacity: 1;
	width: 100%;
	height: 100%;
	mix-blend-mode: normal;
}

/* A light squash & stretch on top of the group's move: the underline
   overshoots slightly wider mid-flight before settling back, reinforcing the
   spring easing above without being cartoonish. */
@keyframes sc-nav-indicator-stretch {
	0% {
		transform: scaleX(1);
	}
	50% {
		transform: scaleX(1.06);
	}
	100% {
		transform: scaleX(1);
	}
}
::view-transition-new(nav-indicator) {
	animation: sc-nav-indicator-stretch 360ms cubic-bezier(0.34, 1.35, 0.55, 1);
	transform-origin: center;
}

/* The nav labels ("About" / "News") swap `color` (--fg <-> --accent-text)
   depending which page is current. Naming each one individually (see
   .nav-label in the header rules above, keyed by nav-link-home/-news)
   pulls the label out of the whole-header `site-header` snapshot so the
   color change gets its own short crossfade instead of jumping instantly. */
::view-transition-group(nav-label-home),
::view-transition-group(nav-label-news),
::view-transition-old(nav-label-home),
::view-transition-old(nav-label-news),
::view-transition-new(nav-label-home),
::view-transition-new(nav-label-news) {
	animation-duration: 240ms;
}

@media (prefers-reduced-motion: reduce) {
	::view-transition-group(*),
	::view-transition-old(*),
	::view-transition-new(*) {
		animation: none !important;
	}
}
