/*
Theme Name: オランダからの手紙 (Letters)
Theme URI: https://lettersfromholland.com
Author: Letters from Holland
Description: Custom theme for オランダからの手紙. Photo-led, phone-first, no external fonts or scripts.
Version: 1.0.0
Requires at least: 6.4
Requires PHP: 7.4
License: GPL-2.0-or-later
Text Domain: lfh-letters
*/

/* ---------- Tokens ---------- */
:root {
	--navy: #192746;
	--navy-soft: #3a4a68;
	--blue: #a4c4d1;
	--blue-line: #839da7;
	--frame: #b4ccd2;
	--mist: #eef3f5;
	--paper: #ffffff;
	--ink: #2a2f38;
	--ink-soft: #545c69;
	--rule: #dbe5ea;

	--mincho: "Hiragino Mincho ProN", "Hiragino Mincho Pro", "Yu Mincho", "YuMincho", "BIZ UDPMincho", "Noto Serif JP", "Noto Serif CJK JP", serif;
	--gothic: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Noto Sans CJK JP", "Yu Gothic UI", "Yu Gothic", "YuGothic", Meiryo, sans-serif;

	--step--1: 0.8125rem;
	--step-0: 1.0625rem;
	--step-1: 1.25rem;
	--step-2: clamp(1.375rem, 1.1rem + 1.2vw, 1.75rem);
	--step-3: clamp(1.625rem, 1.2rem + 1.9vw, 2.25rem);

	--gap: clamp(1rem, 0.6rem + 1.6vw, 2rem);
	--frame-w: clamp(10px, 1.6vw, 22px);
	--radius: 3px;
	--wrap: 1180px;
	--measure: 40em;
	--ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
}

body {
	margin: 0;
	background: var(--mist);
	color: var(--ink);
	font-family: var(--gothic);
	font-size: var(--step-0);
	line-height: 1.9;
	letter-spacing: 0.02em;
	font-feature-settings: "palt" 0;
	overflow-wrap: anywhere;
	line-break: strict;
}

::selection { background: var(--blue); color: var(--navy); }
html { scrollbar-color: var(--blue-line) var(--mist); }
:focus-visible { outline: 3px solid var(--navy); outline-offset: 3px; border-radius: 2px; }
input, textarea { caret-color: var(--navy); }

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

a {
	color: var(--navy);
	text-decoration-color: var(--blue-line);
	text-decoration-thickness: 1px;
	text-underline-offset: 0.25em;
	transition: color 160ms var(--ease), text-decoration-color 160ms var(--ease);
}
a:hover { color: var(--navy-soft); text-decoration-color: var(--navy); }

h1, h2, h3, h4 {
	font-family: var(--mincho);
	font-weight: 600;
	line-height: 1.5;
	letter-spacing: 0.06em;
	color: var(--navy);
	text-wrap: balance;
}

.screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	overflow: hidden; clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}
.skip-link:focus {
	position: fixed; top: 0.75rem; left: 0.75rem; z-index: 100;
	width: auto; height: auto; clip: auto;
	padding: 0.6em 1em;
	background: var(--paper); color: var(--navy);
}

.wrap {
	width: min(100% - 2 * var(--gap), var(--wrap));
	margin-inline: auto;
}

/* ---------- Masthead: the framed title card ---------- */
.masthead {
	padding: var(--gap) 0 0;
}
.titlecard {
	display: block;
	background: var(--paper);
	border: var(--frame-w) solid var(--frame);
	text-decoration: none;
	color: var(--ink);
}
.titlecard:hover { color: var(--ink); }
.titlecard__name {
	margin: 0;
	padding: clamp(0.9rem, 0.5rem + 1.8vw, 2.1rem) 1rem clamp(0.6rem, 0.4rem + 1vw, 1.3rem);
	font-family: var(--mincho);
	font-weight: 600;
	font-size: clamp(1.45rem, 1rem + 2.4vw, 2.6rem);
	letter-spacing: 0.14em;
	line-height: 1.3;
	text-align: center;
	color: #111;
}
.titlecard__photos,
.titlecard__tagline { display: block; }
.titlecard__photos {
	position: relative;
	margin-inline: clamp(0.9rem, 7.9%, 150px);
	aspect-ratio: 1600 / 420;
	overflow: hidden;
	background: var(--mist);
}
@media (max-width: 600px) {
	.titlecard__photos { aspect-ratio: 16 / 7; margin-inline: 0.9rem; }
}
.titlecard__photo {
	position: absolute;
	inset: 0;
	background-size: cover;
	background-position: 50% 50%;
	background-repeat: no-repeat;
	opacity: 0;
	animation: lfh-fade calc(var(--n) * 7s) linear infinite;
	/* Start 2s into the cycle so the first photo is already fully visible on load. */
	animation-delay: calc(var(--i) * 7s - 2s);
}
/* The original banners (1900×700) already contain the frame and title; scale so only
   their photo band (1600×420 at y=165) fills the box, at any aspect ratio. */
.titlecard__photo.is-composite {
	background-size: auto 166.667%;
	background-position: 50% 58.93%;
}
.titlecard__photo:first-child { opacity: 1; }
.titlecard__photos[data-count="1"] .titlecard__photo { animation: none; opacity: 1; }
@keyframes lfh-fade {
	0% { opacity: 0; }
	6% { opacity: 1; }
	33% { opacity: 1; }
	39% { opacity: 0; }
	100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
	.titlecard__photo { animation: none; opacity: 0; }
	.titlecard__photo:first-child { opacity: 1; }
}
.titlecard__tagline {
	margin: 0;
	padding: clamp(0.6rem, 0.4rem + 1vw, 1.2rem) 1rem clamp(0.8rem, 0.5rem + 1.2vw, 1.5rem);
	font-family: var(--mincho);
	font-size: clamp(0.85rem, 0.75rem + 0.45vw, 1.1rem);
	letter-spacing: 0.18em;
	text-align: center;
	color: #222;
}

/* Category strip */
.topics {
	margin-top: 0.9rem;
}
.topics ul {
	display: flex;
	gap: 0.4rem;
	margin: 0;
	padding: 0 0 0.35rem;
	list-style: none;
	overflow-x: auto;
	scrollbar-width: thin;
}
.topics a {
	display: inline-block;
	padding: 0.35em 0.95em;
	border: 1px solid var(--blue-line);
	border-radius: 99px;
	background: var(--paper);
	font-size: var(--step--1);
	line-height: 1.6;
	white-space: nowrap;
	text-decoration: none;
	color: var(--navy);
}
.topics a:hover { background: var(--navy); border-color: var(--navy); color: #fff; }
.topics .is-current a { background: var(--navy); border-color: var(--navy); color: #fff; }

/* ---------- Layout ---------- */
.site-body {
	display: grid;
	gap: calc(var(--gap) * 1.5);
	padding-block: calc(var(--gap) * 1.25) calc(var(--gap) * 2.5);
}
@media (min-width: 960px) {
	.site-body { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; }
}

/* ---------- Letters (post list) ---------- */
.list-heading {
	margin: 0 0 1rem;
	font-size: var(--step-2);
}
.list-heading small {
	display: block;
	font-family: var(--gothic);
	font-size: var(--step--1);
	font-weight: 400;
	letter-spacing: 0.04em;
	color: var(--ink-soft);
}

main { container-type: inline-size; min-width: 0; }
.letters {
	display: grid;
	gap: var(--gap);
	margin: 0;
	padding: 0;
	list-style: none;
}
@container (min-width: 560px) {
	.letters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.letters > .letter--lead { grid-column: 1 / -1; }
}

.letter {
	position: relative;
	display: flex;
	flex-direction: column;
	background: var(--paper);
	border-radius: var(--radius);
	box-shadow: 0 1px 2px rgba(25, 39, 70, 0.06), 0 6px 18px -10px rgba(25, 39, 70, 0.18);
	transition: transform 260ms var(--ease), box-shadow 260ms var(--ease);
}
.letter:hover {
	transform: translateY(-3px);
	box-shadow: 0 2px 4px rgba(25, 39, 70, 0.06), 0 16px 30px -14px rgba(25, 39, 70, 0.28);
}
@media (prefers-reduced-motion: reduce) {
	.letter, .letter:hover { transition: none; transform: none; }
}
.letter__photo {
	margin: 0;
	aspect-ratio: 3 / 2;
	overflow: hidden;
	border-radius: var(--radius) var(--radius) 0 0;
	background: var(--mist);
}
.letter__photo img { width: 100%; height: 100%; object-fit: cover; }
/* A post without photos is a plain letter: the pale-blue frame of the title card, no picture box. */
.letter--text { border-top: 6px solid var(--frame); }
.letter--text .letter__body { padding-top: 1.4rem; }
.letter__body {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	flex: 1;
	padding: 1.1rem 1.25rem 1.3rem;
}
.letter__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.2rem 0.9rem;
	margin: 0;
	font-size: var(--step--1);
	letter-spacing: 0.06em;
	color: var(--ink-soft);
}
.letter__meta time { font-variant-numeric: tabular-nums; }
.letter__cat { color: var(--navy); }
.letter__title {
	margin: 0;
	font-size: var(--step-1);
}
.letter__title a {
	text-decoration: none;
	color: var(--navy);
}
/* Whole card is the link target; the title link stretches over it. */
.letter__title a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.letter__title a:focus-visible { outline: none; }
.letter:has(.letter__title a:focus-visible) { outline: 3px solid var(--navy); outline-offset: 3px; }
.letter__excerpt {
	margin: 0;
	font-size: 0.95rem;
	line-height: 1.85;
	color: var(--ink-soft);
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.letter__new {
	display: inline-block;
	padding: 0 0.5em;
	border-radius: 2px;
	background: var(--navy);
	font-size: 0.72rem;
	letter-spacing: 0.1em;
	line-height: 1.7;
	color: #fff;
}

.letter--lead .letter__title { font-size: var(--step-2); line-height: 1.45; }
@container (min-width: 640px) {
	.letter--lead:not(.letter--text) { flex-direction: row; }
	.letter--lead .letter__photo { flex: 0 0 55%; aspect-ratio: 4 / 3; border-radius: var(--radius) 0 0 var(--radius); }
	.letter--lead .letter__body { justify-content: center; padding: 1.75rem 2rem; gap: 0.6rem; }
	.letter--lead .letter__title { font-size: var(--step-3); line-height: 1.4; }
	.letter--lead .letter__excerpt { -webkit-line-clamp: 5; font-size: var(--step-0); }
	.letter--lead.letter--text .letter__body { padding: 2rem 2.5rem; }
	.letter--lead.letter--text .letter__excerpt { -webkit-line-clamp: 3; max-width: var(--measure); }
}

/* ---------- Pagination ---------- */
.pagination { margin-top: calc(var(--gap) * 1.5); }
.pagination .nav-links {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.4rem;
}
.pagination .page-numbers {
	display: grid;
	place-items: center;
	min-width: 2.75rem;
	height: 2.75rem;
	padding: 0 0.8rem;
	border: 1px solid var(--rule);
	border-radius: var(--radius);
	background: var(--paper);
	text-decoration: none;
	font-variant-numeric: tabular-nums;
}
.pagination .page-numbers.current { background: var(--navy); border-color: var(--navy); color: #fff; }
.pagination a.page-numbers:hover { border-color: var(--navy); }

/* ---------- Single post / page ---------- */
.sheet {
	background: var(--paper);
	border-radius: var(--radius);
	padding: clamp(1.25rem, 0.6rem + 3.4vw, 3.5rem) clamp(1.1rem, 0.4rem + 3.6vw, 3.75rem);
	box-shadow: 0 1px 2px rgba(25, 39, 70, 0.06);
}
.entry-header { margin-bottom: clamp(1.5rem, 1rem + 2vw, 2.5rem); }
.entry-title {
	margin: 0.3rem 0 0;
	font-size: var(--step-3);
	line-height: 1.45;
}
.entry-meta {
	margin: 0;
	font-size: var(--step--1);
	letter-spacing: 0.06em;
	color: var(--ink-soft);
}
.entry-meta a { text-decoration: none; }
.entry-meta time { font-variant-numeric: tabular-nums; }
.entry-header::after {
	content: "";
	display: block;
	width: 3.5rem;
	height: 3px;
	margin-top: 1.1rem;
	background: var(--blue);
}

.entry-content { max-width: var(--measure); }
.entry-content > * { margin-block: 0 1.4em; }
.entry-content > :last-child { margin-bottom: 0; }
.entry-content h2 {
	margin-top: 2.4em;
	padding-bottom: 0.35em;
	border-bottom: 1px solid var(--rule);
	font-size: var(--step-2);
}
.entry-content h3 { margin-top: 2em; font-size: var(--step-1); }
.entry-content figure { margin-inline: 0; }
.entry-content img { border-radius: var(--radius); }
.entry-content .wp-block-image,
.entry-content .wp-block-gallery,
.entry-content .wp-block-video,
.entry-content .wp-block-embed { margin-block: 1.8em; }
.entry-content figcaption,
.entry-content .wp-element-caption {
	margin-top: 0.5em;
	font-size: var(--step--1);
	color: var(--ink-soft);
	text-align: center;
}
.entry-content blockquote {
	margin-inline: 0;
	padding: 0.2em 0 0.2em 1.2em;
	border-left: 1px solid var(--blue-line);
	color: var(--ink-soft);
}
.entry-content .wp-block-embed__wrapper { position: relative; }
.entry-content .wp-block-embed.is-type-video .wp-block-embed__wrapper { aspect-ratio: 16 / 9; }
.entry-content .wp-block-embed.is-type-video iframe { width: 100%; height: 100%; }
.entry-content .wp-block-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: 0.5rem; }
.entry-content .wp-block-gallery figure { margin: 0; }
.entry-content .alignleft { float: left; margin: 0.3em 1.5em 1em 0; max-width: 50%; }
.entry-content .alignright { float: right; margin: 0.3em 0 1em 1.5em; max-width: 50%; }
.entry-content .aligncenter { margin-inline: auto; }
.entry-content::after { content: ""; display: table; clear: both; }

.entry-footer {
	max-width: var(--measure);
	margin-top: clamp(2rem, 1.4rem + 2vw, 3rem);
	padding-top: 1.25rem;
	border-top: 1px solid var(--rule);
	font-size: var(--step--1);
	color: var(--ink-soft);
}

.post-nav {
	display: grid;
	gap: 0.75rem;
	margin-top: var(--gap);
}
@media (min-width: 640px) {
	.post-nav { grid-template-columns: 1fr 1fr; }
	.post-nav__next { text-align: right; }
}
.post-nav a {
	display: block;
	height: 100%;
	padding: 1rem 1.2rem;
	border-radius: var(--radius);
	background: var(--paper);
	text-decoration: none;
	box-shadow: 0 1px 2px rgba(25, 39, 70, 0.06);
	transition: box-shadow 200ms var(--ease);
}
.post-nav a:hover { box-shadow: 0 10px 22px -14px rgba(25, 39, 70, 0.35); }
.post-nav span { display: block; font-size: var(--step--1); color: var(--ink-soft); }
.post-nav strong { font-family: var(--mincho); font-weight: 600; letter-spacing: 0.05em; }

/* ---------- Comments ---------- */
.comments {
	margin-top: var(--gap);
}
.comments__title { margin: 0 0 1rem; font-size: var(--step-1); }
.comment-list, .comment-list .children { margin: 0; padding: 0; list-style: none; }
.comment-list .children { margin-left: clamp(0.8rem, 3vw, 2rem); }
.comment-body {
	margin-bottom: 0.9rem;
	padding: 1rem 1.2rem;
	border-radius: var(--radius);
	background: var(--mist);
}
.comment-author { font-weight: 600; color: var(--navy); }
.comment-author .avatar { display: none; }
.comment-author .says { display: none; }
.comment-metadata { font-size: var(--step--1); }
.comment-metadata a { color: var(--ink-soft); text-decoration: none; }
.comment-content p { margin: 0.4em 0 0; }
.reply { font-size: var(--step--1); }
.bypostauthor > .comment-body { background: #e3edf1; }

.comment-respond { margin-top: 1.5rem; }
.comment-reply-title { font-size: var(--step-1); margin: 0 0 0.6rem; }
.comment-form { display: grid; gap: 0.9rem; }
.comment-form p { margin: 0; }
.comment-form label { display: block; margin-bottom: 0.25rem; font-size: var(--step--1); color: var(--ink-soft); }
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea,
.search-form input[type="search"] {
	width: 100%;
	padding: 0.7em 0.85em;
	border: 1px solid var(--blue-line);
	border-radius: var(--radius);
	background: var(--paper);
	font: inherit;
	color: var(--ink);
}
.comment-form textarea { min-height: 9rem; }
.comment-form input:focus, .comment-form textarea:focus, .search-form input:focus {
	outline: 3px solid var(--blue);
	outline-offset: 0;
	border-color: var(--navy);
}
.comment-form-cookies-consent { display: flex; gap: 0.5rem; align-items: baseline; }
.comment-form-cookies-consent label { display: inline; }
.comment-notes, .logged-in-as { font-size: var(--step--1); color: var(--ink-soft); }

.button, .comment-form input[type="submit"], .search-form button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 2.75rem;
	padding: 0.5em 1.4em;
	border: 0;
	border-radius: var(--radius);
	background: var(--navy);
	font: inherit;
	font-size: 0.95rem;
	letter-spacing: 0.08em;
	color: #fff;
	cursor: pointer;
	text-decoration: none;
	transition: background 160ms var(--ease);
}
.button:hover, .comment-form input[type="submit"]:hover, .search-form button:hover { background: var(--navy-soft); color: #fff; }

/* ---------- Sidebar ---------- */
.sidebar {
	display: grid;
	gap: var(--gap);
	align-content: start;
}
.side-block {
	background: var(--paper);
	border-radius: var(--radius);
	padding: 1.25rem 1.3rem 1.4rem;
	box-shadow: 0 1px 2px rgba(25, 39, 70, 0.06);
}
.side-block__title {
	margin: 0 0 0.9rem;
	padding: 0.3rem 0.8rem;
	background: var(--blue);
	font-size: 0.98rem;
	letter-spacing: 0.12em;
	color: var(--navy);
}
.profile__photo {
	width: 9rem;
	height: 9rem;
	margin: 0.4rem auto 1rem;
	border-radius: 50%;
	border: 5px solid var(--frame);
	object-fit: cover;
}
.profile__text { margin: 0; font-size: 0.92rem; line-height: 1.95; white-space: pre-line; }
.profile__links { margin: 1rem 0 0; display: flex; gap: 0.6rem; }
.profile__links a {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	min-height: 2.75rem;
	padding: 0 1rem;
	border: 1px solid var(--blue-line);
	border-radius: 99px;
	font-size: var(--step--1);
	text-decoration: none;
}
.profile__links a:hover { border-color: var(--navy); }
.profile__links svg { width: 1.1rem; height: 1.1rem; }

.side-list { margin: 0; padding: 0; list-style: none; }
.side-list li { border-top: 1px solid var(--rule); }
.side-list li:first-child { border-top: 0; }
.side-list a {
	display: block;
	padding: 0.6rem 0.1rem;
	font-size: 0.92rem;
	line-height: 1.6;
	text-decoration: none;
}
.side-list a:hover { color: var(--navy-soft); text-decoration: underline; }
.side-list time, .side-list .count {
	display: block;
	font-size: 0.78rem;
	color: var(--ink-soft);
	font-variant-numeric: tabular-nums;
}
.side-list--inline { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.side-list--inline li { border: 0; }
.side-list--inline a {
	padding: 0.25em 0.8em;
	border: 1px solid var(--rule);
	border-radius: 99px;
	font-size: var(--step--1);
}
.side-list--inline a:hover { border-color: var(--navy); text-decoration: none; }

.search-form { display: flex; gap: 0.4rem; }
.search-form__field { flex: 1; }
.search-form button { min-width: 2.75rem; padding: 0 0.8rem; }
.search-form button svg { width: 1.15rem; height: 1.15rem; }

/* ---------- Footer ---------- */
.site-footer {
	background: var(--navy);
	color: #dfe8ee;
	padding: calc(var(--gap) * 1.75) 0 calc(var(--gap) * 1.5);
}
.site-footer a { color: #fff; text-decoration-color: rgba(255, 255, 255, 0.4); }
.site-footer__name {
	margin: 0;
	font-family: var(--mincho);
	font-size: var(--step-1);
	letter-spacing: 0.16em;
	color: #fff;
}
.site-footer__tag { margin: 0.2rem 0 1.2rem; font-size: var(--step--1); letter-spacing: 0.12em; }
.site-footer__small { margin: 0; font-size: 0.78rem; color: #b9c7d3; }
.site-footer__small a { margin-right: 1rem; }

/* ---------- Misc ---------- */
.notice {
	padding: 2rem;
	border-radius: var(--radius);
	background: var(--paper);
	text-align: center;
}
.notice h1 { margin-top: 0; font-size: var(--step-2); }

.to-top {
	position: fixed;
	right: 1rem;
	bottom: 1rem;
	z-index: 20;
	display: grid;
	place-items: center;
	width: 2.9rem;
	height: 2.9rem;
	border-radius: 50%;
	background: var(--navy);
	color: #fff;
	box-shadow: 0 6px 16px -6px rgba(25, 39, 70, 0.5);
	opacity: 0;
	pointer-events: none;
	transition: opacity 200ms var(--ease);
}
.to-top.is-visible { opacity: 1; pointer-events: auto; }
.to-top:hover { color: #fff; background: var(--navy-soft); }
.to-top svg { width: 1.1rem; height: 1.1rem; }
