/*
Theme Name: Night Train
Theme URI: https://anotherbackpack.com
Author: another backpack
Description: A photo-first theme for another backpack. Big photographs, galleries grouped by continent and country, light and dark schemes, and a random-adventure button.
Version: 1.7.0
Requires at least: 6.1
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: night-train
Tags: dark, light, photography, blog, custom-header, custom-menu, featured-images
*/

/* Tokens ----------------------------------------------------------------- */
:root {
	--nt-bg: #121311;
	--nt-panel: #181A17;
	--nt-line: #2A2C28;
	--nt-line-2: #3A3C37;
	--nt-text: #ECE7DE;
	--nt-soft: #C9C3B8;
	--nt-muted: #A8A397;
	--nt-accent: #F2A541;          /* Customizer › Night Train › Accent colour */
	--nt-accent-text: var(--nt-accent);
	--nt-on-accent: #121311;
	--nt-display: "Inconsolata", ui-monospace, Menlo, monospace;
	--nt-mono: var(--nt-display);
	--nt-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
	--nt-radius: 6px;
	--nt-max: 1280px;              /* page width */
	--nt-wide: 1080px;             /* gallery title, lead photo, photo grids */
	--nt-measure: 840px;           /* gallery text column */
	--nt-pad: clamp(16px, 3vw, 32px);
	color-scheme: dark;
}

/* Light scheme: data-nt-mode is set before paint by the script in <head>;
   data-nt-scheme="light" covers visitors without JavaScript. */
:root[data-nt-mode="light"],
:root[data-nt-scheme="light"]:not([data-nt-mode]) {
	--nt-bg: #F7F6F2;
	--nt-panel: #FFFFFF;
	--nt-line: #E3DFD7;
	--nt-line-2: #CDC8BD;
	--nt-text: #161714;
	--nt-soft: #3C3B36;
	--nt-muted: #67635A;
	--nt-accent-text: color-mix(in srgb, var(--nt-accent) 55%, #000);
	color-scheme: light;
}

/* Base ------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0; background: var(--nt-bg); color: var(--nt-text);
	font: 17px/1.6 var(--nt-body); -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--nt-text); text-decoration: none; }
a:hover, a:focus-visible { color: var(--nt-accent-text); }
:focus-visible { outline: 2px solid var(--nt-accent); outline-offset: 3px; }
::selection { background: var(--nt-accent); color: var(--nt-on-accent); }

.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); white-space: nowrap; }
.nt-skip { position: absolute; left: -9999px; top: 8px; z-index: 100; padding: 10px 16px; border-radius: 4px; background: var(--nt-accent); color: var(--nt-on-accent); }
.nt-skip:focus { left: 8px; }

.nt-wrap { max-width: var(--nt-max); margin: 0 auto; padding-left: var(--nt-pad); padding-right: var(--nt-pad); }

/* Small uppercase labels */
.nt-mono, .nt-kicker, .nt-stats span, .nt-card__place, .nt-crumbs, .nt-facts span, .nt-chips span, .nt-pagination .page-numbers {
	font-family: var(--nt-mono); color: var(--nt-muted);
}
.nt-mono { font-size: 13px; }
.nt-kicker { margin: 0 0 14px; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--nt-accent-text); }

/* Headings */
.nt-h2, .nt-h3, .nt-logo, .nt-hero__title, .nt-stats b, .nt-feature__title, .nt-card__title, .nt-region h3, .nt-single__title, .nt-content h1, .nt-content h2, .nt-content h3, .nt-adjacent b {
	font-family: var(--nt-display); font-weight: 400;
}
.nt-h2, .nt-logo, .nt-hero__title, .nt-feature__title, .nt-single__title { letter-spacing: -.01em; }
.nt-h2 { margin: 0; font-weight: 300; font-size: clamp(32px, 4vw, 44px); line-height: 1.05; }
.nt-h3 { margin: 0 0 20px; font-size: 26px; }

/* Buttons and fields */
.nt-btn, .wpcf7 input[type="submit"] {
	display: inline-flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 26px;
	border: 0; border-radius: 26px; background: var(--nt-accent); color: var(--nt-on-accent);
	font: 600 16px/1 var(--nt-body); white-space: nowrap; cursor: pointer;
}
.nt-btn:hover, .nt-btn:focus-visible { color: var(--nt-on-accent); filter: brightness(1.08); }
.nt-iconbtn {
	display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
	border: 1px solid var(--nt-line-2); border-radius: 22px; background: transparent; color: var(--nt-text); cursor: pointer;
}
.nt-iconbtn:hover { color: var(--nt-accent-text); border-color: var(--nt-accent); }
.nt-searchform input, .comment-form input[type="text"], .comment-form input[type="email"], .comment-form input[type="url"], .comment-form textarea, .wpcf7 input:not([type="submit"]), .wpcf7 textarea {
	width: 100%; padding: 12px 14px; border: 1px solid var(--nt-line-2); border-radius: var(--nt-radius);
	background: var(--nt-panel); color: var(--nt-text); font: 16px var(--nt-body);
}

/* Header ----------------------------------------------------------------- */
.nt-header { position: relative; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 24px; padding-bottom: 24px; }
.nt-logo { font-weight: 500; font-size: 26px; line-height: 1; white-space: nowrap; }
.nt-logo span { color: var(--nt-accent-text); }
.nt-nav { order: 1; margin-left: auto; display: flex; align-items: center; gap: 8px; }
.nt-tools { order: 2; display: flex; align-items: center; gap: 8px; }
.nt-menu-toggle { display: none; }
.nt-scheme-toggle span { display: inline-flex; }
.nt-scheme-toggle .nt-ico-moon,
:root[data-nt-mode="light"] .nt-scheme-toggle .nt-ico-sun { display: none; }
:root[data-nt-mode="light"] .nt-scheme-toggle .nt-ico-moon { display: inline-flex; }

.nt-menu { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px; }
.nt-menu > li { position: relative; }
.nt-menu a { display: block; padding: 12px 14px; font-size: 15px; font-weight: 500; }
.nt-menu .current-menu-item > a, .nt-menu .current-menu-ancestor > a { color: var(--nt-accent-text); }
.nt-menu .sub-menu {
	position: absolute; left: 0; top: 100%; z-index: 20; min-width: 220px; margin: 0; padding: 8px; list-style: none;
	background: var(--nt-panel); border: 1px solid var(--nt-line); border-radius: var(--nt-radius);
	opacity: 0; visibility: hidden; transform: translateY(4px); transition: .15s ease;
}
.nt-menu li:hover > .sub-menu, .nt-menu li:focus-within > .sub-menu { opacity: 1; visibility: visible; transform: none; }
.nt-menu .sub-menu a { padding: 10px 12px; border-radius: 4px; }
.nt-menu .sub-menu a:hover { background: var(--nt-line); }

.nt-search { order: 4; width: 100%; }
.nt-search[hidden] { display: none; }
.nt-searchform { display: flex; gap: 8px; max-width: 560px; margin-left: auto; }
.nt-searchform input { flex: 1; min-width: 0; min-height: 48px; padding: 0 18px; border-radius: 24px; }
.nt-searchform input::placeholder { color: var(--nt-muted); }
.nt-searchform button { min-height: 48px; padding: 0 20px; border: 0; border-radius: 24px; background: var(--nt-text); color: var(--nt-bg); font: 600 15px var(--nt-body); cursor: pointer; }

/* Home: hero, stats, cards, regions --------------------------------------- */
.nt-hero-wrap { padding-top: 8px; }
.nt-hero {
	position: relative; display: flex; align-items: flex-end; min-height: clamp(420px, 62vw, 620px);
	border-radius: var(--nt-radius); overflow: hidden; background: #2E3A2F; color: #ECE7DE; /* always light text over the photo */
}
.nt-hero__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.nt-hero__shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(18,19,17,0) 35%, rgba(18,19,17,.88) 100%); }
.nt-hero .nt-kicker { color: var(--nt-accent); }
.nt-hero__body { position: relative; width: 100%; padding: clamp(24px, 4vw, 48px); display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 28px; }
.nt-hero__text { max-width: 780px; }
.nt-hero__title { margin: 0; font-weight: 300; font-size: clamp(40px, 6.2vw, 78px); line-height: .98; }

.nt-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 24px clamp(40px, 10vw, 140px); padding-top: 40px; padding-bottom: 40px; border-bottom: 1px solid var(--nt-line); text-align: center; }
.nt-stats b { display: block; font-size: 48px; line-height: 1.1; }
.nt-stats span { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }

.nt-section { padding-top: 72px; padding-bottom: 24px; }
.nt-section__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 32px; }
.nt-section > .nt-h2 { margin-bottom: 32px; }
.nt-more { font-size: 15px; font-weight: 500; color: var(--nt-accent-text); }
.nt-section__head .nt-more { display: none; } /* "surprise me" lives in the footer */

.nt-feature { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px; align-items: center; margin-bottom: 56px; }
.nt-feature__title { margin: 0 0 16px; font-weight: 300; font-size: clamp(32px, 4vw, 48px); line-height: 1.02; }
.nt-feature__text { margin: 0; max-width: 520px; font-size: 18px; color: var(--nt-soft); }
.nt-feature:hover .nt-feature__title { color: var(--nt-accent-text); }

.nt-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px; }
.nt-card { display: flex; flex-direction: column; gap: 12px; }
.nt-card__place { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
.nt-card__title { font-size: 22px; line-height: 1.15; }

.nt-feature__img, .nt-card__img { border-radius: var(--nt-radius); overflow: hidden; background: var(--nt-panel); }
.nt-feature__img { aspect-ratio: 3 / 2; }
.nt-card__img { aspect-ratio: 4 / 5; }
.nt-feature__img img, .nt-card__img img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.nt-feature:hover img, .nt-card:hover img { transform: scale(1.03); }
.nt-noimg { display: block; width: 100%; height: 100%; background: linear-gradient(135deg, var(--nt-panel), var(--nt-line-2)); }

.nt-regions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.nt-region { display: flex; flex-direction: column; gap: 20px; padding: 28px; border: 1px solid var(--nt-line); border-radius: var(--nt-radius); background: var(--nt-panel); }
.nt-region__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.nt-region h3 { margin: 0; font-size: 30px; }
.nt-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.nt-chips a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 1px solid var(--nt-line-2); border-radius: 22px; font-size: 15px; }
.nt-chips a:hover { border-color: var(--nt-accent); }
.nt-chips span { font-size: 12px; }

/* Gallery page ----------------------------------------------------------- */
.nt-single__head { padding-top: 48px; padding-bottom: 40px; text-align: center; }
.nt-crumbs { margin-bottom: 20px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; }
.nt-crumbs a { color: var(--nt-muted); }
.nt-crumbs a:last-child { color: var(--nt-accent-text); }
.nt-single__title { max-width: var(--nt-wide); margin: 0 auto; font-weight: 300; font-size: clamp(44px, 8vw, 96px); line-height: 1.05; }
.nt-fit { white-space: nowrap; overflow: hidden; }                  /* one line, sized by js/theme.js */
.nt-fit.nt-fit-wrap { white-space: normal; overflow-wrap: anywhere; } /* only if it would drop below 13px */

.nt-lead { max-width: calc(var(--nt-wide) + 2 * var(--nt-pad)); margin: 0 auto; padding: 0 var(--nt-pad); }
.nt-lead img { width: 100%; max-height: 82vh; object-fit: cover; border-radius: var(--nt-radius); }

.nt-single__body { padding-top: 48px; padding-bottom: 72px; }
.nt-facts { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px 48px; max-width: var(--nt-measure); margin: 0 auto 48px; padding-bottom: 24px; border-bottom: 1px solid var(--nt-line); text-align: center; }
.nt-facts div { display: flex; flex-direction: column; gap: 4px; }
.nt-facts span { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.nt-facts b { font-weight: 500; font-size: 15px; }
.nt-facts b a { color: var(--nt-soft); }

/* Content: text in a centred column, photo grids wider */
.nt-content { min-width: 0; }
.nt-single__body--page .nt-content { max-width: 760px; margin: 0 auto; }
.nt-content > :is(p, ul, ol, h1, h2, h3, h4, blockquote, .wp-caption, figure:not(.wp-block-gallery)) { max-width: var(--nt-measure); margin-left: auto; margin-right: auto; }
.nt-single .nt-content :is(.gallery, .wp-block-gallery, .modula) { max-width: var(--nt-wide); margin-left: auto; margin-right: auto; }
.nt-content p { margin-top: 0; margin-bottom: 1.2em; color: var(--nt-soft); }
.nt-content > p:first-child, .nt-content > h1:first-child + p { font-size: 22px; line-height: 1.55; color: var(--nt-text); }
.nt-content h1 { margin-top: 0; margin-bottom: .6em; font-weight: 300; font-size: 40px; line-height: 1.15; color: var(--nt-text); }
.nt-content h2, .nt-content h3 { margin-top: 1.6em; margin-bottom: .6em; line-height: 1.15; color: var(--nt-text); }
.nt-content a { color: var(--nt-accent-text); text-decoration: underline; text-underline-offset: 3px; }
.nt-content a:has(img) { text-decoration: none; }
.nt-content blockquote { margin-top: 1.5em; margin-bottom: 1.5em; padding-left: 20px; border-left: 2px solid var(--nt-accent); font-size: 20px; color: var(--nt-text); }
.nt-content img { border-radius: var(--nt-radius); }
.nt-content figure { margin: 2em 0; }
.nt-content figcaption, .nt-content .wp-caption-text { margin-top: 10px; font-size: 14px; color: var(--nt-muted); }
.nt-content .wp-caption { max-width: 100%; }
.nt-content .alignleft { float: left; margin: .3em 1.5em 1em 0; }
.nt-content .alignright { float: right; margin: .3em 0 1em 1.5em; }
.nt-content .aligncenter { margin-left: auto; margin-right: auto; }

/* Photo galleries: full-width rows, each photo in its own proportions
   (--r = width / height). js/theme.js sizes the rows; until then, and
   without JavaScript, flexbox gives a close approximation. */
.nt-content .nt-justified { --nt-row: 220px; display: flex; flex-wrap: wrap; gap: 12px; margin-top: 2em; margin-bottom: 2em; }
.nt-content .nt-justified::after { content: ""; flex-grow: 999999; }
.nt-content .nt-j-item { flex: var(--r) 1 calc(var(--r) * var(--nt-row)); min-width: 0; margin: 0; display: flex; flex-direction: column; }
.nt-content .nt-j-item a { display: block; text-decoration: none; }
.nt-content .nt-j-item img { width: 100%; height: auto; aspect-ratio: var(--r); object-fit: cover; border: 0; border-radius: 4px; cursor: zoom-in; transition: opacity .2s ease; }
.nt-content .nt-j-item a:hover img { opacity: .88; }
.nt-content .nt-justified.nt-js::after { content: none; }
.nt-content .nt-justified.nt-js .nt-j-item { flex: 0 0 auto; }
.nt-content .nt-justified.nt-js .nt-j-item img { aspect-ratio: auto; height: var(--h); }

/* Block-editor galleries (if any) */
.nt-content .wp-block-gallery { gap: 16px; }
.nt-content .wp-block-gallery .wp-block-image { align-self: flex-start; flex-direction: column !important; }
.nt-content .wp-block-gallery .wp-block-image img { width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; cursor: zoom-in; }
.nt-content .wp-block-gallery .wp-block-image figcaption { position: static !important; max-height: none !important; padding: 0 !important; background: none !important; }

/* Captions: one line until the photo (or caption) is clicked */
.nt-content .gallery-caption, .nt-content .wp-block-gallery figcaption {
	width: 100%; max-width: none; margin: 8px 0 0; padding: 0;
	font-size: 13px !important; line-height: 1.5; text-align: left !important; color: var(--nt-muted) !important;
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
}
.nt-content .is-open .gallery-caption, .nt-content .is-open figcaption { white-space: normal; overflow: visible; }

.nt-content .modula, .nt-content .modula-gallery { margin: 2em 0; }
.nt-content .modula .modula-item { border-radius: var(--nt-radius); overflow: hidden; }

/* Lightbox (Responsive Lightbox / prettyPhoto): black text on its white panel */
.pp_pic_holder :is(.pp_content, .pp_content *, .pp_details, .pp_details *, .pp_description, .currentTextHolder) { color: #000 !important; }
.pp_pic_holder .pp_description { font: 14px/1.5 var(--nt-body); }

/* Previous / next */
.nt-adjacent { border-top: 1px solid var(--nt-line); }
.nt-adjacent__in { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; padding-top: 40px; padding-bottom: 40px; }
.nt-adjacent a { display: flex; flex-direction: column; gap: 8px; }
.nt-adjacent a.is-next { grid-column: 2; text-align: right; }
.nt-adjacent .nt-mono { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
.nt-adjacent b { font-size: 28px; line-height: 1.15; }

/* Archives, search, 404 -------------------------------------------------- */
.nt-archive__head { display: flex; flex-direction: column; gap: 24px; margin-bottom: 40px; }
.nt-archive__head .nt-kicker { margin: 0; }
.nt-archive__desc { max-width: 720px; color: var(--nt-soft); }
.nt-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 20px; padding: 40px 0 80px; color: var(--nt-soft); }
.nt-empty .nt-searchform { width: 100%; margin-left: 0; }
.nt-pagination { margin-top: 48px; }
.nt-pagination .nav-links { display: flex; flex-wrap: wrap; gap: 8px; }
.nt-pagination .page-numbers { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 44px; padding: 0 14px; border: 1px solid var(--nt-line-2); border-radius: 22px; font-size: 14px; color: var(--nt-text); }
.nt-pagination .current { background: var(--nt-accent); border-color: var(--nt-accent); color: var(--nt-on-accent); }

/* Comments (only when switched on) -------------------------------------- */
.nt-comments-wrap { padding-bottom: 72px; }
.nt-comments { max-width: 720px; padding-top: 40px; border-top: 1px solid var(--nt-line); }
.nt-comment-list { list-style: none; margin: 0 0 40px; padding: 0; }
.nt-comment-list .comment-body { padding: 20px 0; border-bottom: 1px solid var(--nt-line); color: var(--nt-soft); }
.nt-comment-list .avatar { float: left; margin-right: 12px; border-radius: 50%; }
.nt-comment-list .children { list-style: none; padding-left: 24px; }
.comment-meta a, .comment-metadata { font-size: 13px; color: var(--nt-muted); }
.comment-form label { display: block; margin-bottom: 6px; font-size: 14px; color: var(--nt-muted); }
.comment-form-cookies-consent { display: flex; align-items: center; gap: 10px; }
.comment-form-cookies-consent label { display: inline; margin: 0; }

/* Footer ----------------------------------------------------------------- */
.nt-footer { margin-top: 48px; border-top: 1px solid var(--nt-line); }
.nt-footer__in { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; padding-top: 40px; padding-bottom: 40px; font-size: 14px; color: var(--nt-muted); }
.nt-footer__menu { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 20px; }
.nt-footer__menu a { color: var(--nt-soft); }

/* Responsive ------------------------------------------------------------- */
@media (max-width: 1024px) {
	.nt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.nt-content .nt-justified { --nt-row: 200px; }
}

@media (max-width: 760px) {
	body { font-size: 16px; }
	.nt-header { row-gap: 0; }
	.nt-logo { font-size: 21px; }
	.nt-tools { margin-left: auto; gap: 6px; }
	.nt-menu-toggle { display: inline-flex; }
	.nt-nav { order: 3; display: none; width: 100%; margin-left: 0; flex-direction: column; align-items: stretch; gap: 12px; padding-top: 8px; }
	.nt-nav.is-open { display: flex; }
	.nt-menu { flex-direction: column; }
	.nt-menu a { padding: 12px 0; border-bottom: 1px solid var(--nt-line); }
	.nt-menu .sub-menu { position: static; opacity: 1; visibility: visible; transform: none; padding: 0 0 0 16px; border: 0; background: none; }
	.nt-search-toggle { align-self: flex-start; }
	.nt-section { padding-top: 48px; }
	.nt-hero__body { gap: 20px; }
	.nt-feature, .nt-regions { grid-template-columns: minmax(0, 1fr); gap: 24px; }
	.nt-lead { padding: 0; }
	.nt-lead img { border-radius: 0; }
	.nt-content > p:first-child, .nt-content > h1:first-child + p { font-size: 19px; }
	.nt-content .alignleft, .nt-content .alignright { float: none; margin: 1em 0; }
	.nt-content .nt-justified { --nt-row: 140px; gap: 8px; }
	.nt-adjacent__in { grid-template-columns: minmax(0, 1fr); }
	.nt-adjacent a.is-next { grid-column: auto; text-align: left; }
}

@media (max-width: 460px) {
	.nt-grid { grid-template-columns: minmax(0, 1fr); }
	.nt-btn { width: 100%; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
	* { transition: none !important; }
}
