/*
Theme Name: CropCorp
Theme URI: https://cropcorp.co.uk/
Author: Web Level Up
Author URI: https://weblevelup.co.uk/
Description: Custom lightweight theme for CropCorp — a comedic co-op action tower defense. Built to look like the game's own HUD. Mobile-first, no framework, no jQuery.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 8.0
License: GNU General Public License v2 or later
Text Domain: cropcorp
*/

/* ==========================================================================
   0. Tokens — palette lifted directly from Source/CropCorp/CCBlocks.h,
      converted linear -> sRGB so the site and the build cannot drift apart.
   ========================================================================== */

:root {
	/* In-game surface colours */
	--cc-grass:       #90bf7c;
	--cc-grass-dark:  #81ad6f;
	--cc-soil:        #816c59;
	--cc-wood:        #bc9e79;
	--cc-fence:       #b39976;
	--cc-stone:       #c4c4c8;
	--cc-coin:        #ffe559;
	--cc-granary:     #f9ce6c;
	--cc-hero:        #61b3e1;
	--cc-hero-trim:   #f9e57c;
	--cc-suit:        #95979e;
	--cc-suit-dark:   #6f7379;
	--cc-tie:         #da5961;

	/* Night-field surfaces — the site's own ground, darker than any lit
	   in-game surface so the game colours read as light sources. */
	--cc-night:       #12160e;
	--cc-night-2:     #1a2014;
	--cc-panel:       #222a1a;
	--cc-panel-2:     #2c3522;
	--cc-line:        #3a4630;

	/* Ink */
	--cc-ink:         #fcfcf8;
	--cc-ink-muted:   #b9c2ac;
	--cc-ink-dim:     #8b957e;

	/* Roles */
	--cc-accent:      var(--cc-coin);
	--cc-good:        #9eeaa2;
	--cc-bad:         var(--cc-tie);

	/* Type */
	--cc-font-display: "CropCorp Display", "Trebuchet MS", "Segoe UI", system-ui, -apple-system, sans-serif;
	--cc-font-body:    system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--cc-font-hud:     ui-monospace, "Cascadia Mono", "Consolas", "SF Mono", Menlo, monospace;

	/* Rhythm */
	--cc-gut:         1.25rem;
	--cc-max:         72rem;
	--cc-max-text:    40rem;
	--cc-block:       4px;   /* the chunk unit — everything snaps to this */

	/* The game HUD's signature: hard black offset shadow, never a blur */
	--cc-shadow:      var(--cc-block) var(--cc-block) 0 rgba(0, 0, 0, 0.55);
	--cc-shadow-sm:   2px 2px 0 rgba(0, 0, 0, 0.55);
}

/* ==========================================================================
   1. Reset — minimal, opinionated
   ========================================================================== */

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

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

@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	*, *::before, *::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
}

body {
	margin: 0;
	background: var(--cc-night);
	color: var(--cc-ink);
	font-family: var(--cc-font-body);
	font-size: 1.0625rem;
	line-height: 1.65;
	overflow-x: hidden;
	/* Faint furrow lines — the ploughed field, barely there */
	background-image:
		repeating-linear-gradient(
			90deg,
			transparent 0,
			transparent 79px,
			rgba(144, 191, 124, 0.035) 79px,
			rgba(144, 191, 124, 0.035) 80px
		);
}

img, svg, video, canvas { max-width: 100%; height: auto; display: block; }
img { background-color: var(--cc-panel); }

a { color: var(--cc-coin); text-underline-offset: 0.2em; }
a:hover, a:focus-visible { color: var(--cc-granary); }

:focus-visible {
	outline: 3px solid var(--cc-coin);
	outline-offset: 3px;
	border-radius: 2px;
}

/* ==========================================================================
   2. Type
   ========================================================================== */

h1, h2, h3, h4 {
	font-family: var(--cc-font-display);
	font-weight: 800;
	line-height: 1.05;
	letter-spacing: -0.01em;
	margin: 0 0 0.5em;
	text-wrap: balance;
}

h1 { font-size: clamp(2.25rem, 9vw, 4.5rem); }
h2 { font-size: clamp(1.75rem, 6vw, 2.75rem); }
h3 { font-size: clamp(1.25rem, 4vw, 1.5rem); }

p { margin: 0 0 1.15em; text-wrap: pretty; }
p:last-child { margin-bottom: 0; }

/* The HUD label — uppercase, tracked out, hard shadow. Used for every
   eyebrow and stat caption, exactly like the in-game canvas labels. */
.cc-hud-label {
	font-family: var(--cc-font-hud);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--cc-accent);
	text-shadow: var(--cc-shadow-sm);
	margin: 0 0 0.75rem;
	display: block;
}

.cc-lede {
	font-size: clamp(1.0625rem, 2.6vw, 1.3125rem);
	color: var(--cc-ink-muted);
	max-width: var(--cc-max-text);
}

/* ==========================================================================
   3. Layout
   ========================================================================== */

.cc-wrap {
	width: 100%;
	max-width: var(--cc-max);
	margin-inline: auto;
	padding-inline: var(--cc-gut);
}

.cc-section { padding-block: clamp(3rem, 10vw, 6rem); }
.cc-section--tight { padding-block: clamp(2rem, 6vw, 3.5rem); }

.cc-section--panel {
	background: var(--cc-night-2);
	border-block: var(--cc-block) solid var(--cc-line);
}

.skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	z-index: 999;
	background: var(--cc-coin);
	color: var(--cc-night);
	padding: 0.75rem 1.25rem;
	font-weight: 700;
}
.skip-link:focus { left: 0; }

/* ==========================================================================
   4. Buttons — chunky, offset, they "press" down on click
   ========================================================================== */

.cc-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	font-family: var(--cc-font-display);
	font-size: 1.0625rem;
	font-weight: 800;
	letter-spacing: 0.02em;
	text-decoration: none;
	padding: 0.9rem 1.6rem;
	min-height: 48px;
	border: none;
	cursor: pointer;
	background: var(--cc-coin);
	color: var(--cc-night);
	box-shadow: var(--cc-shadow);
	transition: transform 0.08s ease, box-shadow 0.08s ease, background-color 0.15s ease;
}

.cc-btn:hover, .cc-btn:focus-visible {
	background: var(--cc-granary);
	color: var(--cc-night);
	transform: translate(-2px, -2px);
	box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.55);
}

/* Pressed: the button sinks into its own shadow */
.cc-btn:active {
	transform: translate(var(--cc-block), var(--cc-block));
	box-shadow: 0 0 0 rgba(0, 0, 0, 0.55);
}

.cc-btn--ghost {
	background: transparent;
	color: var(--cc-ink);
	box-shadow: inset 0 0 0 var(--cc-block) var(--cc-line);
}
.cc-btn--ghost:hover, .cc-btn--ghost:focus-visible {
	background: var(--cc-panel);
	color: var(--cc-ink);
	box-shadow: inset 0 0 0 var(--cc-block) var(--cc-grass);
	transform: translate(-2px, -2px);
}
.cc-btn--ghost:active { transform: none; }

.cc-btn-row {
	display: flex;
	flex-wrap: wrap;
	gap: 0.875rem;
	margin-top: 2rem;
}

/* ==========================================================================
   5. Site header
   ========================================================================== */

.cc-header {
	position: sticky;
	top: 0;
	z-index: 100;
	background: rgba(18, 22, 14, 0.92);
	backdrop-filter: blur(8px);
	border-bottom: 2px solid var(--cc-line);
}

.cc-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	min-height: 64px;
}

.cc-logo {
	display: inline-flex;
	align-items: center;
	gap: 0.6rem;
	font-family: var(--cc-font-display);
	font-size: 1.25rem;
	font-weight: 800;
	color: var(--cc-ink);
	text-decoration: none;
	letter-spacing: -0.02em;
}
.cc-logo:hover { color: var(--cc-ink); }
.cc-logo__mark { flex: 0 0 auto; }
.cc-logo__corp { color: var(--cc-coin); }

/* Mobile-first nav: a slide-down panel, no JS dependency for layout */
.cc-nav-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	padding: 0;
	background: transparent;
	border: 2px solid var(--cc-line);
	color: var(--cc-ink);
	cursor: pointer;
}
.cc-nav-toggle:hover { border-color: var(--cc-grass); }

.cc-nav {
	display: none;
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	background: var(--cc-night-2);
	border-bottom: var(--cc-block) solid var(--cc-line);
	padding: 0.5rem var(--cc-gut) 1.25rem;
}
.cc-nav.is-open { display: block; }

.cc-nav ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}

.cc-nav a {
	display: block;
	padding: 0.75rem 0.5rem;
	font-family: var(--cc-font-display);
	font-weight: 700;
	font-size: 1.0625rem;
	color: var(--cc-ink);
	text-decoration: none;
	border-left: var(--cc-block) solid transparent;
}
.cc-nav a:hover,
.cc-nav .current-menu-item > a {
	color: var(--cc-coin);
	border-left-color: var(--cc-coin);
	background: var(--cc-panel);
}

.cc-header__cta { display: none; }

@media (min-width: 56rem) {
	.cc-nav-toggle { display: none; }
	.cc-nav {
		display: block;
		position: static;
		background: none;
		border: none;
		padding: 0;
		margin-left: auto;
	}
	.cc-nav ul { flex-direction: row; gap: 0.25rem; align-items: center; }
	.cc-nav a {
		padding: 0.5rem 0.85rem;
		font-size: 0.9375rem;
		border-left: none;
		border-bottom: 2px solid transparent;
	}
	.cc-nav a:hover,
	.cc-nav .current-menu-item > a {
		background: none;
		border-left: none;
		border-bottom-color: var(--cc-coin);
	}
	.cc-header__cta { display: inline-flex; margin-left: 0.75rem; }
	.cc-btn--sm { padding: 0.6rem 1.1rem; font-size: 0.9375rem; min-height: 40px; }
}

/* ==========================================================================
   6. Hero
   ========================================================================== */

.cc-hero {
	position: relative;
	overflow: hidden;
	background:
		linear-gradient(180deg, rgba(18, 22, 14, 0.15) 0%, rgba(18, 22, 14, 0.86) 62%, var(--cc-night) 100%),
		linear-gradient(180deg, #7ba7c9 0%, #a8c8de 45%, var(--cc-grass-dark) 46%, var(--cc-grass) 100%);
	padding-block: clamp(3.5rem, 14vw, 8rem);
	border-bottom: var(--cc-block) solid var(--cc-line);
}

.cc-hero__inner { position: relative; z-index: 2; }

.cc-hero h1 {
	text-shadow: var(--cc-block) var(--cc-block) 0 rgba(0, 0, 0, 0.6);
	margin-bottom: 0.35em;
}
.cc-hero h1 .cc-hero__corp { color: var(--cc-coin); display: block; }

.cc-hero__tagline {
	font-family: var(--cc-font-display);
	font-size: clamp(1.125rem, 4.2vw, 1.75rem);
	font-weight: 700;
	color: var(--cc-granary);
	text-shadow: var(--cc-shadow-sm);
	margin: 0 0 1rem;
	max-width: 28ch;
}

.cc-hero__lede { max-width: 46ch; color: var(--cc-ink); }

/* Status flag — "COMING SOON", styled as an in-game objective banner */
.cc-status {
	display: inline-flex;
	align-items: center;
	gap: 0.6rem;
	background: var(--cc-tie);
	color: var(--cc-ink);
	font-family: var(--cc-font-hud);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	padding: 0.45rem 0.9rem;
	box-shadow: var(--cc-shadow-sm);
	margin-bottom: 1.25rem;
}

.cc-status__dot {
	width: 8px;
	height: 8px;
	background: var(--cc-ink);
	animation: cc-pulse 1.6s steps(2, end) infinite;
}

@keyframes cc-pulse { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0.25; } }

/* Floating coins — collectors "pop into a shower of coins", so the hero
   drops a few. Decorative only, hidden from assistive tech. */
.cc-hero__coins {
	position: absolute;
	inset: 0;
	z-index: 1;
	pointer-events: none;
}
.cc-coin-bit {
	position: absolute;
	width: 14px;
	height: 14px;
	background: var(--cc-coin);
	box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.35);
	opacity: 0;
	animation: cc-coin-fall 6s linear infinite;
}
@keyframes cc-coin-fall {
	0%   { transform: translateY(-10vh) rotate(0deg);   opacity: 0; }
	10%  { opacity: 1; }
	90%  { opacity: 1; }
	100% { transform: translateY(110vh) rotate(220deg); opacity: 0; }
}

/* ==========================================================================
   7. HUD panel — the reusable card. Mirrors the in-game translucent panel.
   ========================================================================== */

.cc-panel {
	background: var(--cc-panel);
	border: 2px solid var(--cc-line);
	box-shadow: var(--cc-shadow);
	padding: clamp(1.25rem, 4vw, 1.75rem);
}

.cc-grid {
	display: grid;
	gap: 1.25rem;
	grid-template-columns: 1fr;
}

@media (min-width: 40rem) { .cc-grid--2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 52rem) {
	.cc-grid--3 { grid-template-columns: repeat(3, 1fr); }
	.cc-grid--4 { grid-template-columns: repeat(4, 1fr); }
}

.cc-feature__icon {
	font-size: 1.75rem;
	line-height: 1;
	margin-bottom: 0.75rem;
	display: block;
}
.cc-feature h3 { margin-bottom: 0.4em; color: var(--cc-ink); }
.cc-feature p { color: var(--cc-ink-muted); margin: 0; font-size: 0.9688rem; }

/* ==========================================================================
   8. Stat bars — the granary/health bar, reused as a data display
   ========================================================================== */

.cc-stat { display: block; }
.cc-stat__head {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 1rem;
	font-family: var(--cc-font-hud);
	font-size: 0.75rem;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--cc-ink-muted);
	margin-bottom: 0.4rem;
}
.cc-stat__val { color: var(--cc-coin); font-weight: 700; }

.cc-bar {
	height: 14px;
	background: var(--cc-suit-dark);
	border: 2px solid rgba(0, 0, 0, 0.5);
	overflow: hidden;
}
.cc-bar__fill {
	height: 100%;
	background: var(--cc-granary);
	transition: width 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}
.cc-bar__fill--good { background: var(--cc-good); }
.cc-bar__fill--bad  { background: var(--cc-bad); }

/* ==========================================================================
   9. Roadmap
   ========================================================================== */

.cc-phase { margin-bottom: 2rem; }
.cc-phase__head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem;
	margin-bottom: 0.35rem;
}
.cc-phase__head h3 { margin: 0; }

.cc-tag {
	font-family: var(--cc-font-hud);
	font-size: 0.6875rem;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	padding: 0.3rem 0.6rem;
	background: var(--cc-panel-2);
	color: var(--cc-ink-muted);
	border: 2px solid var(--cc-line);
}
.cc-tag--done { background: var(--cc-good); color: #122a14; border-color: transparent; }
.cc-tag--now  { background: var(--cc-coin); color: var(--cc-night); border-color: transparent; }

.cc-phase__goal {
	color: var(--cc-ink-dim);
	font-style: italic;
	margin-bottom: 1rem;
	max-width: var(--cc-max-text);
}

.cc-checklist { list-style: none; margin: 0; padding: 0; }
.cc-checklist li {
	position: relative;
	padding-left: 2rem;
	margin-bottom: 0.6rem;
	color: var(--cc-ink-muted);
}
.cc-checklist li::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0.35em;
	width: 16px;
	height: 16px;
	border: 2px solid var(--cc-line);
	background: var(--cc-night);
}
.cc-checklist li.is-done { color: var(--cc-ink); }
.cc-checklist li.is-done::before {
	background: var(--cc-good);
	border-color: var(--cc-good);
}
/* The tick: two blocks rotated, drawn not fonted, so it never goes missing */
.cc-checklist li.is-done::after {
	content: "";
	position: absolute;
	left: 5px;
	top: calc(0.35em + 3px);
	width: 5px;
	height: 9px;
	border-right: 3px solid #122a14;
	border-bottom: 3px solid #122a14;
	transform: rotate(42deg);
}
.cc-checklist li.is-doing::before {
	background: var(--cc-coin);
	border-color: var(--cc-coin);
}

/* ==========================================================================
   10. Screenshots
   ========================================================================== */

.cc-shots { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 44rem) { .cc-shots { grid-template-columns: repeat(2, 1fr); } }

.cc-shot {
	margin: 0;
	border: var(--cc-block) solid var(--cc-line);
	box-shadow: var(--cc-shadow);
	background: var(--cc-panel);
}
.cc-shot img { width: 100%; }
.cc-shot figcaption {
	font-family: var(--cc-font-hud);
	font-size: 0.75rem;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--cc-ink-dim);
	padding: 0.7rem 0.9rem;
	border-top: 2px solid var(--cc-line);
}

/* ==========================================================================
   11. Devlog
   ========================================================================== */

.cc-posts { display: grid; gap: 1.5rem; grid-template-columns: 1fr; }
@media (min-width: 48rem) { .cc-posts { grid-template-columns: repeat(2, 1fr); } }

.cc-post-card { display: flex; flex-direction: column; }
.cc-post-card h3 { margin-bottom: 0.35em; }
.cc-post-card h3 a { color: var(--cc-ink); text-decoration: none; }
.cc-post-card h3 a:hover { color: var(--cc-coin); }
.cc-post-card p { color: var(--cc-ink-muted); font-size: 0.9688rem; }

.cc-meta {
	font-family: var(--cc-font-hud);
	font-size: 0.75rem;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--cc-ink-dim);
	margin-bottom: 0.6rem;
}

/* Long-form article body */
.cc-prose { max-width: var(--cc-max-text); }
.cc-prose > * { margin-bottom: 1.15em; }
.cc-prose h2 { margin-top: 2em; }
.cc-prose h3 { margin-top: 1.6em; }
.cc-prose img,
.cc-prose figure {
	max-width: none;
	width: 100%;
	border: var(--cc-block) solid var(--cc-line);
	box-shadow: var(--cc-shadow);
	margin-block: 2rem;
}
.cc-prose figure img { border: none; box-shadow: none; margin: 0; }
.cc-prose blockquote {
	margin-inline: 0;
	padding: 0.5rem 0 0.5rem 1.25rem;
	border-left: var(--cc-block) solid var(--cc-coin);
	color: var(--cc-ink);
	font-style: italic;
}
.cc-prose code {
	font-family: var(--cc-font-hud);
	font-size: 0.9em;
	background: var(--cc-panel);
	padding: 0.15em 0.4em;
	border: 1px solid var(--cc-line);
}
.cc-prose pre {
	background: var(--cc-panel);
	border: 2px solid var(--cc-line);
	padding: 1rem;
	overflow-x: auto;
}
.cc-prose pre code { background: none; border: none; padding: 0; }

.cc-prose table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.cc-prose th, .cc-prose td {
	padding: 0.6rem 0.75rem;
	border: 2px solid var(--cc-line);
	text-align: left;
}
.cc-prose th {
	background: var(--cc-panel);
	font-family: var(--cc-font-hud);
	font-size: 0.75rem;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--cc-coin);
}
.cc-table-scroll { overflow-x: auto; margin-block: 2rem; }

/* ==========================================================================
   12. Signup
   ========================================================================== */

.cc-signup { max-width: 34rem; }
.cc-signup__row { display: flex; flex-direction: column; gap: 0.75rem; }
@media (min-width: 34rem) { .cc-signup__row { flex-direction: row; } }

.cc-input {
	flex: 1 1 auto;
	min-height: 48px;
	padding: 0.85rem 1rem;
	font-family: var(--cc-font-body);
	font-size: 1rem;
	color: var(--cc-ink);
	background: var(--cc-night);
	border: 2px solid var(--cc-line);
}
.cc-input::placeholder { color: var(--cc-ink-dim); }
.cc-input:focus { border-color: var(--cc-coin); }

.cc-form-note { font-size: 0.8125rem; color: var(--cc-ink-dim); margin-top: 0.75rem; }
.cc-form-msg { margin-top: 0.9rem; font-weight: 700; }
.cc-form-msg--ok  { color: var(--cc-good); }
.cc-form-msg--err { color: var(--cc-bad); }

/* Honeypot — off-screen, never display:none (bots skip hidden fields) */
.cc-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* ==========================================================================
   13. Footer
   ========================================================================== */

.cc-footer {
	background: var(--cc-night-2);
	border-top: var(--cc-block) solid var(--cc-line);
	padding-block: clamp(2.5rem, 8vw, 4rem);
	font-size: 0.9375rem;
}
.cc-footer__grid { display: grid; gap: 2rem; grid-template-columns: 1fr; }
@media (min-width: 44rem) { .cc-footer__grid { grid-template-columns: 2fr 1fr 1fr; } }

.cc-footer h2 {
	font-size: 0.75rem;
	font-family: var(--cc-font-hud);
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--cc-coin);
	margin-bottom: 0.9rem;
}
.cc-footer ul { list-style: none; margin: 0; padding: 0; }
.cc-footer li { margin-bottom: 0.5rem; }
.cc-footer a { color: var(--cc-ink-muted); text-decoration: none; }
.cc-footer a:hover { color: var(--cc-coin); text-decoration: underline; }

.cc-colophon {
	margin-top: 2.5rem;
	padding-top: 1.5rem;
	border-top: 2px solid var(--cc-line);
	color: var(--cc-ink-dim);
	font-size: 0.8125rem;
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1.5rem;
	justify-content: space-between;
}

/* ==========================================================================
   14. Utilities
   ========================================================================== */

.cc-center { text-align: center; }
.cc-center .cc-lede, .cc-center .cc-hud-label { margin-inline: auto; }
.cc-center .cc-btn-row { justify-content: center; }

.screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.cc-mt-0 { margin-top: 0; }
.cc-mb-0 { margin-bottom: 0; }
