/*
	Ryunosuke Goto — personal site
	Sidebar layout, light/dark, bilingual (en/ja).
*/

/* ---------- Tokens ---------- */

:root {
	--sidebar-w: 18.5rem;
	--content-max: 46rem;

	--bg: #ffffff;
	--bg-sidebar: #fafaf8;
	--fg: #1b1d1c;
	--fg-muted: #6c716f;
	--fg-faint: #6f7472;
	--rule: #e6e5e1;
	--rule-strong: #d3d2cd;
	--accent: #2f7d6d;
	--accent-hover: #226053;
	--tag-bg: #eef3f1;
	--tag-fg: #3d6b61;
	--focus: #2f7d6d;

	--sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
		Helvetica, "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP",
		"Yu Gothic Medium", Meiryo, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #14161a;
		--bg-sidebar: #101216;
		--fg: #e8eae9;
		--fg-muted: #a0a6a4;
		--fg-faint: #7f8583;
		--rule: #262a30;
		--rule-strong: #343a41;
		--accent: #63c3ae;
		--accent-hover: #86d6c4;
		--tag-bg: #1b2a27;
		--tag-fg: #7fcbb9;
		--focus: #63c3ae;
	}
}

/* ---------- Reset / base ---------- */

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

html {
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--fg);
	font: 400 16px/1.65 var(--sans);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

:lang(ja) body,
body:lang(ja) {
	line-height: 1.8;
}

a {
	color: var(--accent);
	text-decoration: none;
	border-bottom: 1px solid transparent;
	transition: color 0.15s ease, border-color 0.15s ease;
}

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

a:focus-visible,
:focus-visible {
	outline: 2px solid var(--focus);
	outline-offset: 2px;
	border-radius: 2px;
}

img {
	max-width: 100%;
	height: auto;
}

p {
	margin: 0 0 1.15em;
}

ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

/* ---------- Skip link ---------- */

.skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	z-index: 100;
}

.skip-link:focus {
	left: 0.5rem;
	top: 0.5rem;
	padding: 0.5rem 0.85rem;
	background: var(--bg);
	border: 1px solid var(--accent);
	border-radius: 4px;
}

/* ---------- Sidebar ---------- */

.sidebar {
	position: fixed;
	inset: 0 auto 0 0;
	width: var(--sidebar-w);
	padding: 3rem 2rem 2rem;
	background: var(--bg-sidebar);
	border-right: 1px solid var(--rule);
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 1.75rem;
}

.sidebar__avatar {
	display: block;
	width: 6.75rem;
	height: 6.75rem;
	border-radius: 50%;
	object-fit: cover;
	box-shadow: 0 0 0 1px var(--rule-strong);
}

.sidebar__name {
	margin: 0.9rem 0 0.15rem;
	font-size: 1.2rem;
	font-weight: 600;
	letter-spacing: -0.005em;
	line-height: 1.3;
}

.sidebar__name a {
	color: inherit;
}

.sidebar__name a:hover {
	color: var(--accent);
	border-bottom-color: transparent;
}

.sidebar__kana {
	margin: 0 0 0.35rem;
	font-size: 0.9rem;
	color: var(--fg-muted);
}

.sidebar__title {
	margin: 0 0 0.35rem;
	font-size: 0.88rem;
	line-height: 1.4;
	color: var(--fg);
}

.sidebar__email {
	margin: 0;
	font-size: 0.85rem;
	color: var(--fg-muted);
	word-break: break-word;
}

/* Social icons */

.socials {
	display: flex;
	flex-wrap: wrap;
	gap: 1.1rem;
	align-items: center;
	padding-top: 1.25rem;
	border-top: 1px solid var(--rule);
}

/* Secondary links (CV) */

.sidebar__meta {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	font-size: 0.9rem;
}

.socials a {
	color: var(--fg-faint);
	font-size: 1.2rem;
	border-bottom: 0;
	line-height: 1;
}

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

.socials .label {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* ---------- Top tab bar ---------- */

.page {
	margin-left: var(--sidebar-w);
}

.topbar {
	position: sticky;
	top: 0;
	z-index: 20;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1.5rem;
	padding: 0 3.5rem;
	background: var(--bg);
	border-bottom: 1px solid var(--rule-strong);
}

.tabs {
	display: flex;
	flex-wrap: wrap;
	align-items: stretch;
	gap: 0 1.75rem;
}

.tabs a {
	display: block;
	padding: 1.05rem 0;
	margin-bottom: -1px;
	color: var(--fg-muted);
	font-size: 0.95rem;
	line-height: 1.4;
	border-bottom: 2px solid transparent;
	white-space: nowrap;
}

.tabs a:hover {
	color: var(--fg);
	border-bottom-color: var(--rule-strong);
}

.tabs a[aria-current="page"] {
	color: var(--accent);
	font-weight: 600;
	border-bottom-color: var(--accent);
}

.topbar__lang {
	flex: 0 0 auto;
	font-size: 0.9rem;
}

/* ---------- Main ---------- */

.main {
	padding: 3rem 3.5rem 5rem;
}

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

.page-title {
	margin: 0 0 0.3rem;
	font-size: 1.75rem;
	font-weight: 600;
	letter-spacing: -0.015em;
	line-height: 1.25;
}

.page-subtitle {
	margin: 0 0 2.75rem;
	color: var(--fg-muted);
	font-size: 1rem;
}

.lede {
	font-size: 1.03rem;
}

/* Home pages carry the title in the sidebar, so the lede follows the heading directly. */
.page-title + .lede {
	margin-top: 1.75rem;
}

.section {
	margin-top: 3.25rem;
}

.section__title {
	margin: 0 0 1.25rem;
	padding-bottom: 0.5rem;
	border-bottom: 1px solid var(--rule-strong);
	font-size: 0.8rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.11em;
	color: var(--fg-muted);
}

:lang(ja) .section__title {
	font-size: 0.9rem;
	letter-spacing: 0.06em;
	text-transform: none;
}

.section__note {
	margin: 0 0 1.5rem;
	color: var(--fg-muted);
	font-size: 0.95rem;
}

/* ---------- Year / content rows ---------- */

.rows {
	display: grid;
	gap: 0;
	list-style: none;
	margin: 0;
	padding: 0;
}

.row {
	display: grid;
	grid-template-columns: 5.5rem 1fr;
	gap: 0 1.25rem;
	padding: 0.95rem 0;
	border-bottom: 1px solid var(--rule);
}

.row:last-child {
	border-bottom: 0;
}

.row__when {
	color: var(--fg-faint);
	font-size: 0.9rem;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
	padding-top: 0.1em;
}

.row__what {
	min-width: 0;
}

.row__what strong {
	font-weight: 600;
}

/* These are real block elements now (<p>), so no display:block needed. */
.row__title {
	margin: 0;
}

.row__where {
	margin: 0;
	color: var(--fg-muted);
	font-size: 0.94rem;
}

.row__desc {
	margin: 0.25rem 0 0;
	color: var(--fg-muted);
	font-size: 0.92rem;
}

/* Publication rows */

.pub__cite {
	margin: 0;
}

.pub cite {
	font-style: italic;
}

.pub__cite sup {
	font-size: 0.7em;
	line-height: 0;
}

.pub__note {
	margin: 0.3rem 0 0;
	color: var(--fg-faint);
	font-size: 0.86rem;
}

.pub .self {
	font-weight: 600;
}

.pub__links {
	margin-top: 0.3rem;
	font-size: 0.88rem;
	color: var(--fg-faint);
}

.tag {
	display: inline-block;
	margin-left: 0.4rem;
	padding: 0.05rem 0.4rem;
	border-radius: 3px;
	background: var(--tag-bg);
	color: var(--tag-fg);
	font-size: 0.72rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	vertical-align: 0.1em;
	white-space: nowrap;
}

:lang(ja) .tag {
	text-transform: none;
	letter-spacing: 0;
}

/* ---------- Under construction ---------- */

.notice {
	margin-top: 2rem;
	padding: 1.75rem;
	border: 1px dashed var(--rule-strong);
	border-radius: 6px;
	color: var(--fg-muted);
	background: var(--bg-sidebar);
}

.notice p:last-child {
	margin-bottom: 0;
}

/* ---------- Footer ---------- */

.site-footer {
	margin-top: 4.5rem;
	padding-top: 1.5rem;
	border-top: 1px solid var(--rule);
	color: var(--fg-faint);
	font-size: 0.85rem;
}

.site-footer p {
	margin: 0;
}

/* ---------- Responsive ---------- */

@media screen and (max-width: 62rem) {
	.sidebar {
		position: static;
		width: auto;
		height: auto;
		padding: 2.25rem 1.5rem 1.5rem;
		border-right: 0;
		border-bottom: 1px solid var(--rule);
		gap: 1.25rem;
	}

	.sidebar__header {
		display: flex;
		align-items: center;
		gap: 1.1rem;
	}

	.sidebar__avatar {
		width: 4.5rem;
		height: 4.5rem;
		flex: 0 0 auto;
	}

	.sidebar__name {
		margin-top: 0;
	}

	.sidebar__meta {
		flex-direction: row;
		flex-wrap: wrap;
		gap: 0.4rem 1.25rem;
	}

	.page {
		margin-left: 0;
	}

	.topbar {
		padding: 0 1.5rem;
		gap: 1rem;
	}

	.tabs {
		flex-wrap: nowrap;
		overflow-x: auto;
		gap: 0 1.25rem;
		scrollbar-width: none;
		-webkit-overflow-scrolling: touch;
	}

	.tabs::-webkit-scrollbar {
		display: none;
	}

	.tabs a {
		padding: 0.85rem 0;
		font-size: 0.9rem;
	}

	.main {
		padding: 2rem 1.5rem 3.5rem;
	}
}

@media screen and (max-width: 34rem) {
	body {
		font-size: 15.5px;
	}

	.page-title {
		font-size: 1.5rem;
	}

	.row {
		grid-template-columns: 1fr;
		gap: 0.2rem;
	}

	.row__when {
		padding-top: 0;
		font-size: 0.85rem;
	}

	.topbar {
		flex-direction: column;
		align-items: flex-start;
		gap: 0;
		padding: 0 1.25rem;
	}

	.tabs {
		width: 100%;
		gap: 0 1.1rem;
	}

	.topbar__lang {
		padding-bottom: 0.7rem;
	}

	.main {
		padding: 1.75rem 1.25rem 3rem;
	}
}

/* ---------- Print ---------- */

@media print {
	.sidebar,
	.topbar,
	.site-footer {
		display: none;
	}

	.page {
		margin: 0;
	}

	.main {
		margin: 0;
		padding: 0;
	}

	body {
		color: #000;
		background: #fff;
	}
}
