/* Braida braider portal
 *
 * Palette comes from two places: the prototype's warm cream/gold light theme,
 * and the logo, which is gold on black. Because the brand mark is a dark
 * lockup, dark is treated as a first-class theme rather than an inversion —
 * the gold sits naturally on it.
 *
 * Themes switch by `data-theme` on <html>. Every colour is a custom property,
 * so a component is written once and both themes follow.
 */

:root {
	/* Brand constants — identical in both themes. */
	--gold: #c2872e;
	--gold-bright: #e0a94a;
	--berry: #a83a63;

	--radius: 14px;
	--radius-sm: 9px;
	--shadow-sm: 0 1px 2px rgba(43, 32, 24, 0.06);
	--shadow: 0 10px 30px rgba(43, 32, 24, 0.10);
	--shadow-lg: 0 24px 60px rgba(43, 32, 24, 0.16);
	--maxw: 1080px;

	--font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	--font-display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
}

/* ---------------------------------------------------------------- Light --- */

[data-theme="light"] {
	--bg: #f4ece0;
	--surface: #ffffff;
	--surface-2: #fbf6ee;
	--surface-sunken: #f0e7da;
	--ink: #2b2018;
	--ink-soft: #6b5849;
	--muted: #786757;
	--line: #e6dac9;
	--line-strong: #d5c4ad;

	--accent: #8f621a;          /* gold darkened to 5.34:1 on --surface */
	--accent-ink: #ffffff;
	--accent-soft: #f6e9ce;
	--accent-soft-ink: #7a5416;

	--danger: #a3324f;
	--danger-soft: #f8e3e9;
	--success: #1f6b4a;
	--success-soft: #dff0e6;

	--logo-chip: #12100c;       /* the gold mark needs a dark ground */
	--overlay: rgba(43, 32, 24, 0.45);
}

/* ----------------------------------------------------------------- Dark --- */

[data-theme="dark"] {
	--bg: #12100c;
	--surface: #1c1811;
	--surface-2: #241f17;
	--surface-sunken: #171410;
	--ink: #f4ece0;
	--ink-soft: #cdbfae;
	--muted: #9d8f7e;
	--line: #322b21;
	--line-strong: #453c2e;

	--accent: #e0a94a;          /* gold brightened to 8.37:1 on --surface */
	--accent-ink: #1a150e;
	--accent-soft: #2e2517;
	--accent-soft-ink: #f0c877;

	--danger: #f08098;
	--danger-soft: #38202a;
	--success: #6cc79b;
	--success-soft: #17301f;

	--logo-chip: transparent;   /* already dark; no chip needed */
	--overlay: rgba(0, 0, 0, 0.6);
}

/* ------------------------------------------------------------------ Base -- */

* { box-sizing: border-box; }

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

body {
	margin: 0;
	background: var(--bg);
	color: var(--ink);
	font-family: var(--font);
	font-size: 16px;
	line-height: 1.55;
	/* Only colours transition; layout properties would make theme switching
	   feel sluggish rather than smooth. */
	transition: background-color .2s ease, color .2s ease;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; margin: 0 0 .4em; }
h1 { font-size: clamp(2rem, 5vw, 3.1rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.45rem, 3vw, 2.05rem); }
h3 { font-size: 1.15rem; font-family: var(--font); font-weight: 650; }
p { margin: 0 0 1rem; color: var(--ink-soft); }
a { color: var(--accent); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 560px; }
.stack > * + * { margin-top: 14px; }
.muted { color: var(--muted); font-size: .875rem; }
.center { text-align: center; }

/* Visible focus everywhere, not just where a designer remembered. */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
	border-radius: 4px;
}

/* --------------------------------------------------------------- Header --- */

.topbar {
	position: sticky; top: 0; z-index: 40;
	background: color-mix(in srgb, var(--bg) 88%, transparent);
	backdrop-filter: saturate(150%) blur(10px);
	border-bottom: 1px solid var(--line);
}
.topbar .inner {
	max-width: var(--maxw); margin: 0 auto; padding: 12px 20px;
	display: flex; align-items: center; gap: 16px;
}

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; margin-right: auto; }
.brand img { display: block; height: 34px; width: auto; }
/* On light, the gold-on-black mark gets its own ground rather than floating on
   cream, where it would read as a stray black rectangle. */
.brand .chip {
	background: var(--logo-chip);
	border-radius: 8px;
	padding: 5px 9px;
	display: flex; align-items: center;
	transition: background-color .2s ease;
}
[data-theme="dark"] .brand .chip { padding: 5px 0; }

/* ---------------------------------------------------------------- Theme --- */

.theme-toggle {
	appearance: none; cursor: pointer;
	width: 38px; height: 38px; padding: 0;
	display: grid; place-items: center;
	border: 1px solid var(--line-strong);
	border-radius: 999px;
	background: var(--surface);
	color: var(--ink);
	transition: background-color .15s ease, border-color .15s ease, transform .1s ease;
}
.theme-toggle:hover { background: var(--surface-2); border-color: var(--accent); }
.theme-toggle:active { transform: scale(.94); }
.theme-toggle svg { width: 18px; height: 18px; }
[data-theme="light"] .theme-toggle .moon,
[data-theme="dark"] .theme-toggle .sun { display: none; }

/* -------------------------------------------------------------- Buttons --- */

.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	padding: 11px 20px; border-radius: 999px;
	font: inherit; font-weight: 600; font-size: .95rem;
	border: 1px solid transparent; cursor: pointer; text-decoration: none;
	transition: transform .1s ease, background-color .15s ease, border-color .15s ease;
	white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not([disabled]) { background: color-mix(in srgb, var(--accent) 86%, black); }

.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover:not([disabled]) { background: var(--surface-2); border-color: var(--accent); }

.btn-quiet { background: transparent; color: var(--muted); padding: 7px 12px; font-size: .85rem; }
.btn-quiet:hover { color: var(--ink); background: var(--surface-2); }

.btn-danger { background: transparent; color: var(--danger); border-color: transparent; padding: 7px 12px; font-size: .85rem; }
.btn-danger:hover { background: var(--danger-soft); }

.btn-block { width: 100%; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }

/* ---------------------------------------------------------------- Cards --- */

.card {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 22px;
	box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.card-head h3 { margin: 0; margin-right: auto; }

/* --------------------------------------------------------------- Fields --- */

.field { margin-bottom: 15px; }
.field label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
.field .hint { font-size: .78rem; color: var(--muted); margin-top: 5px; }

.input, .textarea, .select {
	width: 100%; padding: 11px 13px;
	background: var(--surface-2);
	border: 1px solid var(--line-strong);
	border-radius: var(--radius-sm);
	color: var(--ink); font: inherit; font-size: .95rem;
	transition: border-color .15s ease, background-color .15s ease;
}
.input:focus, .textarea:focus, .select:focus {
	outline: none; border-color: var(--accent); background: var(--surface);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.textarea { min-height: 96px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--muted); }

.row { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 620px) { .row { grid-template-columns: 1fr; } }

.check { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.check input { margin-top: 3px; width: 17px; height: 17px; accent-color: var(--accent); }
.check span { font-size: .9rem; }

/* --------------------------------------------------------------- Alerts --- */

.alert { padding: 12px 15px; border-radius: var(--radius-sm); font-size: .9rem; margin-bottom: 14px; }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-info { background: var(--accent-soft); color: var(--accent-soft-ink); }
.alert:empty { display: none; }

.pill {
	display: inline-flex; align-items: center; gap: 6px;
	padding: 4px 11px; border-radius: 999px;
	font-size: .76rem; font-weight: 650;
	background: var(--accent-soft); color: var(--accent-soft-ink);
}
.pill-success { background: var(--success-soft); color: var(--success); }
.pill-muted { background: var(--surface-sunken); color: var(--muted); }

/* ------------------------------------------------------------ Checklist --- */

.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li {
	display: flex; align-items: center; gap: 11px;
	padding: 9px 0; border-bottom: 1px solid var(--line);
	font-size: .92rem;
}
.checklist li:last-child { border-bottom: 0; }
.tick {
	flex: none; width: 21px; height: 21px; border-radius: 999px;
	display: grid; place-items: center;
	border: 1.5px solid var(--line-strong); color: transparent;
	font-size: .7rem; font-weight: 700;
}
.tick.done { background: var(--success); border-color: var(--success); color: #fff; }
.checklist li.done span { color: var(--muted); text-decoration: line-through; }

.progress { height: 7px; border-radius: 999px; background: var(--surface-sunken); overflow: hidden; margin: 4px 0 14px; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .4s ease; }

/* --------------------------------------------------------------- Styles --- */

.style-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); }

.style-card { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.style-card .body { padding: 15px; }
.style-card h4 { margin: 0 0 3px; font-size: 1rem; font-weight: 650; }
.style-card .meta { font-size: .85rem; color: var(--accent-soft-ink); font-weight: 600; margin-bottom: 7px; }
.style-card p { font-size: .87rem; margin: 0 0 10px; }
.style-card .actions { display: flex; gap: 6px; border-top: 1px solid var(--line); padding: 8px 9px; }

.photos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; background: var(--surface-sunken); }
.photos .slot { position: relative; aspect-ratio: 1; }
.photos img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photos .empty { display: grid; place-items: center; color: var(--muted); font-size: 1.3rem; background: var(--surface-sunken); }
.photos .rm {
	position: absolute; top: 3px; right: 3px;
	width: 21px; height: 21px; border-radius: 999px; border: 0; cursor: pointer;
	background: var(--overlay); color: #fff; font-size: .72rem; line-height: 1;
	display: grid; place-items: center;
}

/* ---------------------------------------------------------------- Hero ---- */

.hero { padding: 68px 0 52px; text-align: center; }
.hero .mark { display: inline-flex; padding: 16px 22px; border-radius: 18px; background: var(--logo-chip); margin-bottom: 26px; }
[data-theme="dark"] .hero .mark { background: transparent; padding: 0; }
.hero .mark img { height: 92px; width: auto; display: block; }
.hero .lede { font-size: 1.12rem; max-width: 560px; margin: 0 auto 26px; }
.hero .cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.features { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(232px, 1fr)); padding: 8px 0 64px; }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.feature .ico { width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-soft-ink); display: grid; place-items: center; font-size: 1.1rem; margin-bottom: 11px; }
.feature h3 { margin-bottom: 5px; }
.feature p { font-size: .9rem; margin: 0; }

/* -------------------------------------------------------------- Portal ---- */

.portal { display: grid; gap: 20px; grid-template-columns: 320px 1fr; align-items: start; padding: 26px 0 70px; }
@media (max-width: 900px) { .portal { grid-template-columns: 1fr; } }
.portal aside { position: sticky; top: 74px; }
@media (max-width: 900px) { .portal aside { position: static; } }

.avatar {
	width: 62px; height: 62px; border-radius: 999px; object-fit: cover;
	border: 2px solid var(--line-strong); background: var(--surface-sunken);
	display: grid; place-items: center; font-family: var(--font-display); font-size: 1.5rem; color: var(--muted);
}

.uploader { position: relative; overflow: hidden; display: inline-flex; }
.uploader input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 200px; }

.empty-state { text-align: center; padding: 34px 18px; color: var(--muted); }
.empty-state .big { font-size: 2rem; margin-bottom: 8px; }

.footer { border-top: 1px solid var(--line); padding: 26px 0; color: var(--muted); font-size: .85rem; }

/* People who prefer less motion get none of it. */
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { transition: none !important; animation: none !important; }
}
