/*
  พื้นฐาน Adobe Lightroom — Lightroom basics condensed, with a heavy
  focus on correct-yet-striking green/forest grading for contest entries.
  Color palette follows VS Code's "Monokai Dimmed" theme (dark editor bg,
  muted foreground, olive-green accent for strings/keywords), distinct
  from LrPs's blue theme and photobasic's dark theme. No build step:
  plain CSS.
*/

* {
	box-sizing: border-box;
}

:root {
	--bg: #1e1e1e;
	--surface: #262626;
	--border: #3a3a3a;
	--fg: #c5c8c6;
	--muted: #9b9b9b;
	--accent: #a6e22e;
	--accent-soft: #333b25;
	--accent-warn: #e5b567;
	--radius: 14px;
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--fg);
	font-family: "Noto Sans Thai", -apple-system, BlinkMacSystemFont,
		"Segoe UI", system-ui, sans-serif;
	line-height: 1.7;
	-webkit-font-smoothing: antialiased;
}

a {
	color: inherit;
}

/* ─── Top bar ─── */
.topbar {
	position: sticky;
	top: 0;
	z-index: 40;
	background: rgba(30, 30, 30, 0.92);
	backdrop-filter: blur(8px);
	border-bottom: 1px solid var(--border);
}

.topbar-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 0.9rem clamp(1.25rem, 4vw, 2rem);
}

.topbar-back {
	font-size: 0.85rem;
	color: var(--muted);
	text-decoration: none;
	white-space: nowrap;
}

.topbar-back:hover {
	color: var(--accent);
}

.topbar-title {
	display: none;
	font-size: 0.85rem;
	font-weight: 600;
}

@media (min-width: 900px) {
	.topbar-title {
		display: block;
	}
}

.menu-toggle {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.5rem 0.85rem;
	border: 1px solid var(--border);
	border-radius: 999px;
	background: var(--surface);
	color: var(--fg);
	font-size: 0.8rem;
	cursor: pointer;
}

@media (min-width: 900px) {
	.menu-toggle {
		display: none;
	}
}

.nav-toggle-desktop {
	display: none;
}

@media (min-width: 900px) {
	.nav-toggle-desktop {
		display: inline-flex;
	}
}

/* ─── Layout ─── */
.layout {
	display: block;
	max-width: 1180px;
	margin: 0 auto;
	padding: 0 clamp(1.25rem, 4vw, 2rem);
}

/* ─── Top nav (desktop) — collapsed by default, expands below the topbar
   on toggle, so content below keeps the full page width the rest of the
   time instead of always sharing it with a sidebar. ─── */
.sidebar {
	display: none;
}

@media (min-width: 900px) {
	.sidebar {
		display: flex;
		flex-wrap: wrap;
		align-items: baseline;
		column-gap: 1.75rem;
		row-gap: 0.5rem;
		max-height: 0;
		overflow: hidden;
		padding: 0 clamp(1.25rem, 4vw, 2rem);
		transition: max-height 0.25s ease, padding 0.25s ease;
	}

	.sidebar.is-open {
		max-height: 12rem;
		padding: 0.75rem clamp(1.25rem, 4vw, 2rem) 1rem;
		border-top: 1px solid var(--border);
	}
}

.sidebar-group {
	display: contents;
}

.sidebar-group-title {
	display: none;
}

.sidebar-link {
	display: inline-block;
	padding: 0.35rem 0;
	font-size: 0.82rem;
	color: var(--muted);
	text-decoration: none;
	border-bottom: 2px solid transparent;
	white-space: nowrap;
}

.sidebar-link:hover {
	color: var(--fg);
}

.sidebar-link.is-active {
	color: var(--accent);
	border-bottom-color: var(--accent);
	font-weight: 600;
}

/* Mobile nav sheet */
.mobile-nav {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 50;
	background: rgba(0, 0, 0, 0.6);
}

.mobile-nav.is-open {
	display: block;
}

.mobile-nav-panel {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	width: min(85vw, 320px);
	background: var(--bg);
	padding: 1.5rem;
	overflow-y: auto;
	box-shadow: -8px 0 24px rgba(0, 0, 0, 0.12);
}

.mobile-nav-close {
	display: block;
	margin-left: auto;
	margin-bottom: 1rem;
	padding: 0.4rem 0.9rem;
	border: 1px solid var(--border);
	border-radius: 999px;
	background: var(--surface);
	font-size: 0.8rem;
	cursor: pointer;
}

/* ─── Main content ─── */
.content {
	min-width: 0;
	padding: 2.5rem 0 6rem;
}

.hero {
	margin-bottom: 3rem;
}

.section-divider {
	margin: 0 0 3rem;
	border: none;
	border-top: 1px solid var(--border);
}

.hero-award-label {
	margin: 0 0 0.75rem;
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--accent);
}

.hero-figure {
	margin: 0 0 3rem;
}

/* Show the full award photo uncropped rather than force-cropping to a
   fixed ratio. */
.hero-figure .img-slot img {
	width: 100%;
	height: auto;
	object-fit: contain;
}

.hero-figure figcaption {
	margin-top: 0.6rem;
	font-size: 0.78rem;
	color: var(--muted);
	font-style: italic;
}

.hero .kicker {
	margin: 0 0 0.75rem;
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--accent);
}

.hero h1 {
	margin: 0 0 1rem;
	font-size: clamp(2rem, 5.5vw, 3rem);
	font-weight: 800;
	letter-spacing: -0.02em;
	line-height: 1.15;
}

.hero p {
	max-width: 40rem;
	margin: 0;
	color: var(--muted);
	font-size: 1rem;
}

.hero .rule-callout {
	margin-top: 1.75rem;
	padding: 1rem 1.25rem;
	background: var(--accent-soft);
	border-radius: var(--radius);
	font-size: 0.9rem;
	color: #d3e8a8;
}

/* ─── Section groups ─── */
.workflow-group {
	margin-bottom: 4rem;
	padding-top: 1rem;
	scroll-margin-top: 4.5rem;
}

.workflow-group-header {
	display: flex;
	align-items: baseline;
	gap: 0.75rem;
	margin-bottom: 0.5rem;
}

.workflow-step-num {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.75rem;
	height: 1.75rem;
	border-radius: 999px;
	background: var(--accent);
	color: #1e1e1e;
	font-size: 0.8rem;
	font-weight: 700;
	flex: none;
}

.workflow-group-header h2 {
	margin: 0;
	font-size: clamp(1.35rem, 3vw, 1.75rem);
	font-weight: 800;
	letter-spacing: -0.01em;
}

.workflow-group-desc {
	margin: 0 0 2rem;
	max-width: 42rem;
	color: var(--muted);
	font-size: 0.92rem;
}

/* ─── Topic card ─── */
.topic {
	margin-bottom: 2rem;
	padding: 1.5rem;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	scroll-margin-top: 4.5rem;
}

.topic h3 {
	margin: 0 0 0.6rem;
	font-size: 1.05rem;
	font-weight: 700;
}

.topic > p {
	margin: 0 0 0.9rem;
	font-size: 0.92rem;
	color: var(--fg);
}

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

.topic-diagram {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin: 0 0 1rem;
	padding: 0.6rem 0.9rem;
	background: var(--accent-soft);
	border-radius: 999px;
	font-size: 0.82rem;
	font-weight: 600;
	color: #d3e8a8;
	flex-wrap: wrap;
}

.topic-diagram .arrow {
	color: var(--accent);
	font-weight: 400;
}

.topic-block {
	margin-top: 1rem;
}

.topic-block h4 {
	margin: 0 0 0.4rem;
	font-size: 0.85rem;
	font-weight: 700;
}

.topic-block p,
.topic-block ul {
	margin: 0;
	font-size: 0.88rem;
	color: var(--muted);
}

.topic-block ul {
	padding-left: 1.1rem;
}

.topic-block li {
	margin-bottom: 0.3rem;
}

.topic-example {
	margin-top: 0.9rem;
	padding: 0.75rem 1rem;
	background: #2b2b2b;
	border-radius: 10px;
	font-size: 0.85rem;
}

.topic-example strong {
	display: block;
	margin-bottom: 0.25rem;
	font-size: 0.75rem;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--muted);
}

.topic-warning {
	margin-top: 0.9rem;
	padding: 0.75rem 1rem;
	background: #3a2f1e;
	border-left: 3px solid var(--accent-warn);
	border-radius: 0 10px 10px 0;
	font-size: 0.85rem;
	color: #e8c98a;
}

.topic-warning strong {
	color: var(--accent-warn);
}

.topic-good {
	margin-top: 0.9rem;
	padding: 0.75rem 1rem;
	background: var(--accent-soft);
	border-left: 3px solid var(--accent);
	border-radius: 0 10px 10px 0;
	font-size: 0.85rem;
	color: #d3e8a8;
}

.topic-good strong {
	color: var(--accent);
}

.topic-compare {
	display: grid;
	grid-template-columns: 1fr;
	gap: 0.75rem;
	margin-top: 1rem;
}

@media (min-width: 560px) {
	.topic-compare {
		grid-template-columns: 1fr 1fr;
	}
}

.topic-compare > div {
	padding: 0.85rem 1rem;
	border-radius: 10px;
	font-size: 0.85rem;
}

.topic-compare .is-plus {
	background: #2a3a24;
}

.topic-compare .is-minus {
	background: #3a2626;
}

.topic-compare strong {
	display: block;
	margin-bottom: 0.35rem;
	font-size: 0.8rem;
}

/* ─── Tables ─── */
.table-wrap {
	overflow-x: auto;
	margin: 1rem 0;
	border: 1px solid var(--border);
	border-radius: var(--radius);
}

table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.85rem;
}

th,
td {
	padding: 0.6rem 0.9rem;
	text-align: left;
	border-bottom: 1px solid var(--border);
	white-space: nowrap;
}

@media (min-width: 700px) {
	th,
	td {
		white-space: normal;
	}
}

th {
	background: #2b2b2b;
	font-weight: 700;
	font-size: 0.78rem;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: var(--muted);
}

tr:last-child td {
	border-bottom: none;
}

td code,
th code {
	font-family: ui-monospace, SFMono-Regular, monospace;
	font-size: 0.85em;
}

/* ─── Image slots (placeholder until real photos are added) ───
   Same pattern as CameraLr-2026/styles/app.css: a missing <img> collapses
   into a labelled dashed placeholder naming the file to drop in, rather
   than showing a broken-image icon. */
.img-slot {
	position: relative;
	overflow: hidden;
	border-radius: var(--radius);
	border: 1px solid var(--border);
}

/* Standalone photos (tagged .photo-natural) show their full, uncropped
   frame instead of being force-cropped by object-fit: cover. Portrait
   shots would otherwise stretch full-width and become excessively tall,
   so they're also capped and centered. */
.img-slot.photo-natural {
	margin: 0 auto;
}

.img-slot.photo-natural img {
	width: 100%;
	height: auto;
	object-fit: contain;
}

.img-slot.photo-natural.is-portrait {
	max-width: 32rem;
}

/* Keep the caption aligned to the (capped, centered) portrait image
   instead of spanning the full article width. */
figure:has(> .img-slot.photo-natural.is-portrait) figcaption {
	max-width: 32rem;
	margin: 0.5rem auto 0;
}

.img-slot img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Lightroom panel screenshots (tagged .panel-shot) are tall/narrow UI crops
   — on large screens, cap their height so they read as a reference
   thumbnail instead of dominating the article. Real photos keep their
   normal size. Left uncapped on mobile, where the viewport already keeps
   panel shots narrow. */
@media (min-width: 900px) {
	.img-slot.panel-shot {
		max-height: 22rem;
		background: #2a2a2a;
	}

	.img-slot.panel-shot img {
		width: auto;
		max-width: 100%;
		height: 100%;
		margin: 0 auto;
		object-fit: contain;
	}

	/* Panel screenshots that must stay fully legible top-to-bottom: scale the
	   whole frame down by width and let the height follow, rather than
	   capping height (which would crop the panel). Overrides the
	   height: 100% above, which fills — and therefore clips — a fixed box. */
	.img-slot.panel-shot.is-compact {
		max-height: none;
		max-width: 30rem;
		margin: 0 auto;
	}

	.img-slot.panel-shot.is-compact img {
		width: 100%;
		height: auto;
	}
}

.img-slot.is-missing {
	display: grid;
	place-items: center;
	min-height: 11rem;
	padding: 1.25rem;
	background-color: var(--accent-soft);
	background-image: repeating-linear-gradient(
		45deg,
		transparent 0 10px,
		rgba(166, 226, 46, 0.08) 10px 11px
	);
	border-style: dashed;
}

.img-slot.is-missing img {
	display: none;
}

.img-slot.is-missing::after {
	content: "รอใส่ภาพ · " attr(data-hint);
	color: #a8c98a;
	font-size: 0.72rem;
	text-align: center;
	line-height: 1.6;
	word-break: break-all;
}

.img-slot.zoomable:not(.is-missing) {
	cursor: zoom-in;
}

.img-slot.zoomable:not(.is-missing) img {
	transition: transform 0.25s ease;
}

.img-slot.zoomable:not(.is-missing):hover img {
	transform: scale(1.03);
}

.img-compare {
	display: grid;
	grid-template-columns: 1fr;
	gap: 0.9rem;
	margin-top: 1rem;
}

@media (min-width: 560px) {
	.img-compare {
		grid-template-columns: 1fr 1fr;
	}
}

.img-compare figure {
	margin: 0;
}

.img-compare .img-slot {
	aspect-ratio: 4 / 3;
}

.img-compare figcaption {
	margin-top: 0.5rem;
	font-size: 0.8rem;
	text-align: center;
}

.img-compare figcaption .tag-good {
	color: var(--accent);
	font-weight: 700;
}

.img-compare figcaption .tag-bad {
	color: #e07a5f;
	font-weight: 700;
}

/* ─── Lightbox ─── */
.lightbox {
	max-width: 100vw;
	max-height: 100vh;
	width: 100%;
	height: 100%;
	padding: 0;
	border: none;
	background: rgb(0 0 0 / 88%);
	overflow: hidden;
}

.lightbox::backdrop {
	background: rgb(0 0 0 / 88%);
}

.lightbox img {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	max-width: calc(100vw - 3rem);
	max-height: calc(100vh - 4rem);
	object-fit: contain;
	border-radius: 8px;
}

.lightbox-close {
	position: absolute;
	top: 1rem;
	right: 1rem;
	z-index: 1;
	display: grid;
	place-items: center;
	width: 2.5rem;
	height: 2.5rem;
	border: 1px solid rgb(255 255 255 / 25%);
	border-radius: 999px;
	background: rgb(0 0 0 / 45%);
	color: #f0ede8;
	font-size: 0.9rem;
	cursor: pointer;
}

.lightbox-close:hover,
.lightbox-close:focus-visible {
	border-color: rgb(255 255 255 / 70%);
}

/* ─── Workshop steps ─── */
.workshop-steps {
	counter-reset: step;
	display: grid;
	gap: 1rem;
}

.workshop-step {
	position: relative;
	padding: 1.1rem 1.25rem 1.1rem 3.25rem;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
}

.workshop-step::before {
	counter-increment: step;
	content: counter(step);
	position: absolute;
	left: 1rem;
	top: 1.1rem;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.6rem;
	height: 1.6rem;
	border-radius: 999px;
	background: var(--accent-soft);
	color: var(--accent);
	font-size: 0.8rem;
	font-weight: 700;
}

.workshop-step h4 {
	margin: 0 0 0.4rem;
	font-size: 0.95rem;
	font-weight: 700;
}

.workshop-step p,
.workshop-step ul {
	margin: 0;
	font-size: 0.88rem;
	color: var(--muted);
}

.workshop-step ul {
	padding-left: 1.1rem;
}

.workshop-step li {
	margin-bottom: 0.3rem;
}

.workshop-step .arrow-flow {
	margin-top: 0.4rem;
	font-size: 0.85rem;
	color: var(--fg);
}

/* ─── Closing principle ─── */
.principle-box {
	margin-top: 2.5rem;
	padding: 1.75rem;
	background: #141414;
	color: #f2f5f0;
	border-radius: var(--radius);
	border: 1px solid var(--border);
}

.principle-box p {
	margin: 0 0 0.75rem;
	font-size: 0.92rem;
	color: #c5c8c6;
}

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

.principle-box strong {
	color: var(--accent);
}

.principle-box .quote {
	font-size: 1.05rem;
	font-weight: 700;
	color: #fff;
}

/* ─── Footer ─── */
footer {
	border-top: 1px solid var(--border);
	padding: 1.75rem clamp(1.25rem, 4vw, 2rem);
	color: var(--muted);
	font-size: 0.75rem;
}

footer .footer-inner {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 1rem;
	max-width: 1180px;
	margin: 0 auto;
}

footer a {
	text-decoration: none;
	color: var(--muted);
}

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