/* =====================================================================
   Farm Cozy Wiki — extends the in-game color identity (cream/teak/gold/jade)
   into a reference-wiki layout. System-font stack only (guaranteed to work
   fully offline, no CDN/internet dependency).
   ===================================================================== */

:root {
	--bg: #fbf3e2;
	--surface: #f4e8ce;
	--surface-2: #eeddb8;
	--ink: #4a3524;
	--ink-soft: #8a6f52;
	--ink-faint: #b39d7d;
	--gold: #ce9a34;
	--gold-deep: #a97a1f;
	--jade: #5c8b5b;
	--jade-deep: #446b45;
	--clay: #bc6b45;
	--frame: #b48a5e;
	--white: #fffaf0;

	--rarity-common: #8d8d8d;
	--rarity-uncommon: #4f9e56;
	--rarity-rare: #3f7fc4;
	--rarity-epic: #8a52c9;
	--rarity-legendary: #d9a020;
	--rarity-divine: #34b3c9;
	--rarity-prismatic: #d874b8;
	--rarity-exalted: #c9463f;

	--font-display: 'Trebuchet MS', 'Segoe UI Rounded', 'Segoe UI', sans-serif;
	--font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;

	--radius: 14px;
	--radius-sm: 8px;
}

* { box-sizing: border-box; }

html, body {
	margin: 0;
	padding: 0;
	background: var(--bg);
	color: var(--ink);
	font-family: var(--font-body);
	height: 100%;
}

body {
	display: flex;
	min-height: 100vh;
}

::selection { background: var(--gold); color: var(--white); }

/* Subtle woven-texture background on the whole page, evokes rattan/basket weave */
body::before {
	content: "";
	position: fixed;
	inset: 0;
	pointer-events: none;
	opacity: 0.035;
	background-image:
		repeating-linear-gradient(45deg, var(--ink) 0, var(--ink) 1px, transparent 1px, transparent 14px),
		repeating-linear-gradient(-45deg, var(--ink) 0, var(--ink) 1px, transparent 1px, transparent 14px);
	z-index: 0;
}

/* =====================================================================
   Sidebar navigation
   ===================================================================== */
.sidebar {
	width: 232px;
	flex-shrink: 0;
	background: var(--surface);
	border-right: 3px solid var(--frame);
	padding: 22px 14px;
	position: sticky;
	top: 0;
	height: 100vh;
	overflow-y: auto;
	z-index: 2;
}

.sidebar h1 {
	font-family: var(--font-display);
	font-size: 21px;
	color: var(--gold-deep);
	margin: 0 8px 4px;
	line-height: 1.25;
}

.sidebar .subtitle {
	font-size: 12px;
	color: var(--ink-soft);
	margin: 0 8px 8px;
}

.disclaimer {
	font-size: 11px;
	color: var(--clay);
	background: rgba(188, 107, 69, 0.1);
	border-left: 3px solid var(--clay);
	padding: 8px 10px;
	margin: 0 8px 16px;
	border-radius: 4px;
	line-height: 1.5;
}

.lang-switcher {
	margin: 0 8px 18px;
	display: flex;
	flex-direction: column;
	gap: 5px;
}
.lang-switcher label {
	font-size: 11.5px;
	font-weight: 700;
	color: var(--ink-soft);
	text-transform: uppercase;
	letter-spacing: 0.04em;
}
.lang-switcher select {
	padding: 9px 12px;
	border-radius: 8px;
	border: 2px solid var(--frame);
	background: var(--white);
	color: var(--ink);
	font-size: 14px;
	font-family: var(--font-body);
	font-weight: 600;
	cursor: pointer;
}

.nav-item {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 11px 12px;
	margin-bottom: 4px;
	border: none;
	background: transparent;
	border-radius: var(--radius-sm);
	color: var(--ink);
	font-family: var(--font-body);
	font-size: 14.5px;
	font-weight: 600;
	text-align: left;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

.nav-item:hover { background: var(--surface-2); }

.nav-item.active {
	background: var(--gold);
	color: var(--white);
}

.nav-dot {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: var(--ink-faint);
	flex-shrink: 0;
}
.nav-item.active .nav-dot { background: var(--white); }

.sidebar-footer {
	margin-top: 24px;
	padding: 12px;
	font-size: 11.5px;
	color: var(--ink-faint);
	line-height: 1.5;
	border-top: 1px solid var(--surface-2);
}

/* =====================================================================
   Main content
   ===================================================================== */
.main {
	flex: 1;
	padding: 28px 36px 60px;
	position: relative;
	z-index: 1;
	max-width: 1180px;
}

.page-header {
	margin-bottom: 22px;
}

.page-header h2 {
	font-family: var(--font-display);
	font-size: 28px;
	color: var(--ink);
	margin: 0 0 6px;
}

.page-header p {
	color: var(--ink-soft);
	margin: 0;
	font-size: 14.5px;
}

.search-row {
	display: flex;
	gap: 10px;
	margin-bottom: 22px;
	flex-wrap: wrap;
}

.search-box {
	flex: 1;
	min-width: 220px;
	padding: 11px 16px;
	border-radius: 999px;
	border: 2px solid var(--frame);
	background: var(--white);
	color: var(--ink);
	font-size: 14.5px;
	font-family: var(--font-body);
	outline: none;
}
.search-box::placeholder { color: var(--ink-faint); }
.search-box:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(206,154,52,0.18); }

.filter-select {
	padding: 10px 14px;
	border-radius: 999px;
	border: 2px solid var(--frame);
	background: var(--white);
	color: var(--ink);
	font-size: 14px;
	font-family: var(--font-body);
	cursor: pointer;
}

.result-count {
	font-size: 13px;
	color: var(--ink-faint);
	margin: -12px 0 18px;
}

/* Section group headers within a tab (e.g. "Vegetable", "Common") */
.group-header {
	font-family: var(--font-display);
	font-size: 17px;
	color: var(--gold-deep);
	margin: 26px 0 12px;
	padding-bottom: 6px;
	border-bottom: 2px solid var(--surface-2);
}
.group-header:first-child { margin-top: 0; }

/* =====================================================================
   Item grid + cards
   ===================================================================== */
.grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 14px;
}

.card {
	background: var(--surface);
	border: 2px solid var(--frame);
	border-radius: var(--radius);
	padding: 14px;
	display: flex;
	gap: 12px;
	position: relative;
	transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.card:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 16px rgba(74,53,36,0.15);
}

.card-thumb {
	width: 56px;
	height: 56px;
	flex-shrink: 0;
	border-radius: 10px;
	background: var(--white);
	border: 2px solid var(--surface-2);
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}
.card-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.card-thumb .fallback-letter {
	font-family: var(--font-display);
	font-size: 22px;
	color: var(--ink-faint);
}

.card-body { flex: 1; min-width: 0; }

.card-title {
	font-weight: 700;
	font-size: 14.5px;
	color: var(--ink);
	margin: 0 0 2px;
	line-height: 1.3;
}
.card-title-th {
	font-size: 12.5px;
	color: var(--ink-soft);
	margin: 0 0 6px;
}

.card-stats {
	font-size: 12px;
	color: var(--ink-soft);
	line-height: 1.65;
}
.card-stats b { color: var(--ink); }

/* Signature element: rarity "hanging price tag" badge — punched hole + notch,
   evokes a farmers-market price tag tied to produce */
.rarity-tag {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 2px 9px 2px 14px;
	border-radius: 3px 8px 8px 3px;
	font-size: 10.5px;
	font-weight: 700;
	color: var(--white);
	position: relative;
	margin-bottom: 6px;
	letter-spacing: 0.02em;
}
.rarity-tag::before {
	content: "";
	position: absolute;
	left: 5px;
	top: 50%;
	transform: translateY(-50%);
	width: 4px;
	height: 4px;
	border-radius: 50%;
	background: rgba(255,255,255,0.85);
}

.rarity-Common { background: var(--rarity-common); }
.rarity-Uncommon { background: var(--rarity-uncommon); }
.rarity-Rare { background: var(--rarity-rare); }
.rarity-Epic { background: var(--rarity-epic); }
.rarity-Legendary { background: var(--rarity-legendary); }
.rarity-Divine { background: var(--rarity-divine); }
.rarity-Prismatic { background: var(--rarity-prismatic); }
.rarity-Exalted { background: var(--rarity-exalted); }

.empty-state {
	text-align: center;
	padding: 60px 20px;
	color: var(--ink-faint);
	font-size: 14px;
}

/* =====================================================================
   Prime Time day cards
   ===================================================================== */
.day-card {
	background: var(--surface);
	border: 2px solid var(--frame);
	border-radius: var(--radius);
	padding: 16px 18px;
	margin-bottom: 12px;
}
.day-card .day-name {
	font-family: var(--font-display);
	font-size: 16px;
	margin: 0 0 4px;
}
.day-card .event-name {
	font-weight: 700;
	color: var(--ink);
	margin-bottom: 8px;
	font-size: 15px;
}
.day-card ul {
	margin: 0;
	padding-left: 18px;
	color: var(--ink-soft);
	font-size: 13.5px;
	line-height: 1.7;
}

/* =====================================================================
   Levels table
   ===================================================================== */
.level-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13.5px;
}
.level-table th {
	text-align: left;
	padding: 10px 12px;
	background: var(--surface-2);
	color: var(--ink);
	position: sticky;
	top: 0;
}
.level-table td {
	padding: 8px 12px;
	border-bottom: 1px solid var(--surface-2);
	color: var(--ink-soft);
}
.level-table tr:nth-child(even) td { background: rgba(238,221,184,0.35); }
.level-table td:first-child { font-weight: 700; color: var(--ink); }

/* =====================================================================
   Mail guide (static prose cards)
   ===================================================================== */
.prose-card {
	background: var(--surface);
	border: 2px solid var(--frame);
	border-radius: var(--radius);
	padding: 18px 20px;
	margin-bottom: 14px;
}
.prose-card h3 {
	font-family: var(--font-display);
	margin: 0 0 8px;
	color: var(--gold-deep);
	font-size: 17px;
}
.prose-card p {
	margin: 0;
	color: var(--ink-soft);
	font-size: 14px;
	line-height: 1.7;
}

/* Craft recipe cards need a bit more room for materials/result lines */
.recipe-card .card-body { display: flex; flex-direction: column; }

.card-thumb.zoomable {
	cursor: zoom-in;
}

.lightbox {
	position: fixed;
	inset: 0;
	background: rgba(20, 14, 8, 0.85);
	display: none;
	align-items: center;
	justify-content: center;
	flex-direction: column;
	z-index: 100;
	cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox img {
	max-width: 85vw;
	max-height: 80vh;
	border-radius: 12px;
	border: 3px solid var(--gold);
	box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.lightbox-caption {
	color: var(--white);
	font-family: var(--font-display);
	font-size: 18px;
	margin-top: 16px;
}

@media (max-width: 860px) {
	body { flex-direction: column; }
	.sidebar {
		width: 100%;
		height: auto;
		position: relative;
		border-right: none;
		border-bottom: 3px solid var(--frame);
		display: flex;
		flex-wrap: wrap;
		align-items: center;
	}
	.sidebar h1, .sidebar .subtitle, .sidebar-footer { width: 100%; }
	.nav-item { width: auto; }
	.main { padding: 20px; }
}
