/* The Gardener Bloom Patch — shared styles for t1mcode.tech/thegardener
   Dark T1M Code chrome with the garden's own colours as accents. No build step:
   this file and lang.js are the only shared pieces, and every page links both. */

:root {
    /* T1M Code palette, the same variables the rest of t1mcode.tech uses. */
    --primary: #6366f1;
    --secondary: #8b5cf6;
    --accent: #22d3ee;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    /* The garden's own palette, from the game. */
    --moss: #7aad5c;
    --moss-deep: #4f7d3a;
    --soil: #6a4527;
    --lilac: #b790e0;
    --gold: #fad04a;
    --petal: #f7b8cd;
    --sky: #b8d4f0;
    --radius: 1rem;
    --shadow: 0 20px 45px rgba(0, 0, 0, 0.35);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* Pictures keep their own shape. Without this, the width and height attributes in the markup
   fight a CSS width and the screenshots come out stretched. */
img { max-width: 100%; height: auto; }

html { scroll-behavior: smooth; overflow-x: clip; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.65;
    /* `clip` rather than `hidden`: it keeps a stray figure off the side without turning the page
       into a scroll container, which would break the sticky header. */
    overflow-x: clip;
}

/* --- Language switch: both languages live in the page, one is hidden. ---------- */

/* Only the language not in use is hidden, so every element keeps its own display value.
   Two attributes and two types outweigh a class selector further down the sheet, and
   <html lang="en"> is never hidden by it. */
html[data-lang='en'] body [lang='nb'],
html[data-lang='nb'] body [lang='en'] { display: none; }

.lang-switch { display: inline-flex; gap: 0.35rem; }

.lang-switch button {
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    font-size: 1.1rem;
    line-height: 1;
    padding: 0.45rem 0.6rem;
    border-radius: 0.6rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.2s;
}

.lang-switch button:hover { transform: translateY(-1px); border-color: var(--accent); }
.lang-switch button[aria-pressed='true'] { background: rgba(34, 211, 238, 0.16); border-color: var(--accent); }

/* --- Page furniture ----------------------------------------------------------- */

.wrap { width: min(1100px, 100% - 2.5rem); margin-inline: auto; }
.narrow { width: min(760px, 100% - 2.5rem); margin-inline: auto; }

header.site {
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(14px);
    background: rgba(15, 23, 42, 0.82);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

header.site .bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.7rem 0;
    flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: inherit; font-weight: 700; }
.brand img { width: 38px; height: 38px; border-radius: 0.6rem; }
.brand span { font-size: 1rem; letter-spacing: -0.01em; }

nav.site-nav { display: flex; gap: 0.2rem; flex-wrap: wrap; margin-left: auto; align-items: center; }

nav.site-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.4rem 0.7rem;
    border-radius: 0.5rem;
    transition: color 0.2s, background 0.2s;
}

nav.site-nav a:hover, nav.site-nav a[aria-current='page'] { color: var(--text-primary); background: rgba(255, 255, 255, 0.06); }

footer.site {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    margin-top: 5rem;
    padding: 2.5rem 0 3.5rem;
    color: var(--text-secondary);
    font-size: 0.88rem;
}

footer.site a { color: var(--accent); text-decoration: none; }
footer.site a:hover { text-decoration: underline; }
footer.site .links { display: flex; gap: 1.2rem; flex-wrap: wrap; margin-bottom: 0.9rem; }

/* --- Type --------------------------------------------------------------------- */

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.02em; }
h1 { font-size: clamp(2.1rem, 5.5vw, 3.6rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 3.2vw, 2.1rem); font-weight: 750; margin-bottom: 0.8rem; }
h3 { font-size: 1.12rem; font-weight: 700; margin-bottom: 0.35rem; }
p { color: var(--text-secondary); }
p strong, li strong { color: var(--text-primary); font-weight: 650; }

.gradient {
    background: linear-gradient(120deg, var(--moss) 0%, var(--gold) 45%, var(--lilac) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.lead { font-size: 1.12rem; max-width: 62ch; }
.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 0.7rem;
}

section { padding: 4rem 0 0; }
section > .wrap > h2 + p.lead, section > .narrow > h2 + p.lead { margin-bottom: 1.6rem; }

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

.hero {
    position: relative;
    padding: 3.5rem 0 1rem;
    overflow: hidden;
    background:
        radial-gradient(900px 420px at 15% -10%, rgba(122, 173, 92, 0.22), transparent 70%),
        radial-gradient(700px 380px at 90% 0%, rgba(139, 92, 246, 0.18), transparent 70%);
}

.hero-grid { display: grid; gap: 2.5rem; grid-template-columns: 1fr; align-items: center; }
.hero-copy .badges { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 1.4rem 0 1.8rem; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.09);
    color: var(--text-secondary);
}

.badge.green { color: #b9e39a; border-color: rgba(122, 173, 92, 0.4); background: rgba(122, 173, 92, 0.12); }
.badge.gold { color: var(--gold); border-color: rgba(250, 208, 74, 0.35); background: rgba(250, 208, 74, 0.1); }

.cta-row { display: flex; gap: 0.7rem; flex-wrap: wrap; align-items: center; }
.store-line { margin-bottom: 1.1rem; }

/* Apple's own badge, black, untouched: Apple's guidelines allow no recolouring,
   and on the dark page it needs no frame of its own. */
.store-badge { display: inline-block; line-height: 0; border-radius: 0.6rem; transition: transform 0.2s, opacity 0.2s; }
.store-badge:hover { transform: translateY(-2px); }
.store-badge:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.store-badge img { display: block; height: auto; }
footer.site .footer-store { margin-bottom: 1.2rem; }
.get { text-align: center; }
.get .lead { margin-left: auto; margin-right: auto; text-wrap: balance; }
.get .store-line { margin: 1.4rem 0 0; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    font-weight: 650;
    font-size: 0.98rem;
    padding: 0.8rem 1.4rem;
    border-radius: 0.8rem;
    transition: transform 0.2s, opacity 0.2s, background 0.2s;
}

.btn:hover { transform: translateY(-2px); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--secondary)); color: #fff; }
.btn-ghost { border: 1px solid rgba(255, 255, 255, 0.14); color: var(--text-primary); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.06); }

.hero-shot { position: relative; }

.hero-shot img.screen {
    width: 100%;
    height: auto;
    border-radius: 1.1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow);
    display: block;
}

/* Figures from the game, drifting over the page. */
.figure { position: absolute; pointer-events: none; filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.35)); }
.figure img { display: block; width: 100%; height: auto; }

.float { animation: float 7s ease-in-out infinite; }
.float-slow { animation: float 11s ease-in-out infinite; }
.float-fast { animation: float 5s ease-in-out infinite; }

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-14px) rotate(2deg); }
}

@media (prefers-reduced-motion: reduce) {
    .float, .float-slow, .float-fast { animation: none; }
    html { scroll-behavior: auto; }
}

/* The figures sit around the screenshot, not on top of its numbers. */
.hero .fig-bee { width: 78px; top: -46px; right: -30px; }
.hero .fig-butterfly { width: 64px; bottom: -22px; left: -18px; }
.hero .fig-ladybug { width: 72px; bottom: -28px; right: 12%; }

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

.cards { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fit, minmax(255px, 1fr)); }

.card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius);
    padding: 1.4rem 1.4rem 1.5rem;
    position: relative;
    overflow: hidden;
    transition: transform 0.25s, border-color 0.25s;
}

.card:hover { transform: translateY(-3px); border-color: rgba(122, 173, 92, 0.45); }
.card p { font-size: 0.95rem; }
.card .pic { height: 74px; margin-bottom: 0.9rem; display: flex; align-items: flex-end; }
.card .pic img { height: 100%; width: auto; }
.card .glyph { font-size: 2rem; line-height: 1; margin-bottom: 0.7rem; display: block; }

/* --- Gallery ------------------------------------------------------------------ */

.gallery { display: grid; gap: 1.2rem; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); }

.gallery figure {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius);
    overflow: hidden;
}

.gallery img { width: 100%; height: auto; display: block; }
.gallery figcaption { padding: 0.85rem 1.1rem 1.1rem; font-size: 0.9rem; color: var(--text-secondary); }

/* --- Steps, tables, notes ------------------------------------------------------ */

.steps { display: grid; gap: 1rem; counter-reset: step; }

.step {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1rem;
    align-items: start;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius);
    padding: 1.15rem 1.3rem;
}

.step::before {
    counter-increment: step;
    content: counter(step);
    display: grid;
    place-items: center;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--moss), var(--moss-deep));
    color: #0b1220;
    font-weight: 800;
    font-size: 0.95rem;
}

table { width: 100%; border-collapse: collapse; margin: 1rem 0 0.4rem; font-size: 0.94rem; }
caption { text-align: left; color: var(--text-secondary); font-size: 0.86rem; padding-bottom: 0.5rem; }
th, td { text-align: left; padding: 0.6rem 0.8rem; border-bottom: 1px solid rgba(255, 255, 255, 0.07); }
th { color: var(--text-primary); font-weight: 650; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; }
td { color: var(--text-secondary); }
td strong { color: var(--text-primary); }
.table-scroll { overflow-x: auto; }

/* Links inside the content, wherever they sit, read as links on the dark background. */
main a:not(.btn):not(.brand) { color: var(--accent); }
main a:not(.btn):not(.brand):hover { text-decoration: underline; }

.note {
    border-left: 3px solid var(--accent);
    background: rgba(34, 211, 238, 0.07);
    padding: 0.9rem 1.1rem;
    border-radius: 0 0.6rem 0.6rem 0;
    margin: 1.2rem 0;
    font-size: 0.94rem;
}

.note.warn { border-left-color: var(--gold); background: rgba(250, 208, 74, 0.08); }

.prose h2 { margin-top: 2.6rem; }
.prose h3 { margin-top: 1.6rem; color: var(--text-primary); }
.prose p, .prose li { color: var(--text-secondary); }
.prose p + p { margin-top: 0.8rem; }
.prose ul, .prose ol { margin: 0.7rem 0 0.7rem 1.2rem; }
.prose li { margin-bottom: 0.4rem; }
.prose a { color: var(--accent); }
.prose .updated { font-size: 0.85rem; color: var(--text-secondary); opacity: 0.8; }

/* --- Form --------------------------------------------------------------------- */

.form-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius);
    padding: 1.8rem;
}

label { display: block; font-size: 0.85rem; color: var(--text-secondary); margin: 1.2rem 0 0.4rem; }
label:first-of-type { margin-top: 0; }
.required { color: #f87171; }

select, input, textarea {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

select:focus, input:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { min-height: 130px; resize: vertical; }
.honeypot { position: absolute; left: -9999px; }

button.send {
    width: 100%;
    padding: 0.85rem;
    margin-top: 1.5rem;
    border: none;
    border-radius: 0.6rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    font-size: 1rem;
    font-weight: 650;
    cursor: pointer;
    transition: opacity 0.2s;
}

button.send:hover { opacity: 0.92; }
button.send:disabled { opacity: 0.5; cursor: not-allowed; }

.msg { text-align: center; margin-top: 1rem; padding: 0.8rem; border-radius: 0.5rem; font-size: 0.92rem; }
.msg.ok { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.msg.err { background: rgba(248, 113, 113, 0.15); color: #f87171; }

/* --- Wider screens ------------------------------------------------------------- */

/* On a phone the figures tuck in, so nothing hangs over the edge. */
@media (max-width: 640px) {
    .hero .fig-bee { width: 60px; top: -26px; right: -4px; }
    .hero .fig-butterfly { width: 50px; bottom: -12px; left: -4px; }
    .hero .fig-ladybug { width: 54px; bottom: -14px; right: 14%; }
}

@media (min-width: 900px) {
    .hero { padding: 5rem 0 2rem; }
    .hero-grid { grid-template-columns: 1.05fr 1fr; gap: 3.5rem; }
    section { padding: 5.5rem 0 0; }
}
