/* ============================================
   Dewdimpple Addon Hub — bento redesign
   References (Glint): Lost (dark bento feature cards),
   Ilya Miskov (calm portfolio intro), Nucleo Icons (pixel grid, one accent)
   ============================================ */

:root {
    --bg: #0c0c0e;
    --surface: #141417;
    --surface-2: #1b1b1f;
    --line: #26262b;
    --grid: rgba(255, 255, 255, 0.035);
    --text: #f2f1ec;
    --muted: #9b9aa3;
    --faint: #66656e;
    --accent: #7bd35a;          /* grass */
    --accent-ink: #0c1a07;
    --accent-soft: rgba(123, 211, 90, 0.14);
    --dirt: #8a5a34;
    --dirt-dark: #6b4426;
    --shadow: 0 1px 0 rgba(255,255,255,0.04) inset, 0 20px 40px -24px rgba(0,0,0,0.8);

    --radius: 22px;
    --font: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, 'Courier New', monospace;
    --pixel: 'Pixelify Sans', var(--mono);
}

:root[data-theme="day"] {
    --bg: #f3f2ed;
    --surface: #ffffff;
    --surface-2: #f6f5f1;
    --line: #e3e1d9;
    --grid: rgba(0, 0, 0, 0.045);
    --text: #17171a;
    --muted: #5d5c64;
    --faint: #8d8c94;
    --accent: #3f9a24;
    --accent-ink: #ffffff;
    --accent-soft: rgba(63, 154, 36, 0.12);
    --shadow: 0 1px 2px rgba(0,0,0,0.04), 0 16px 32px -24px rgba(0,0,0,0.25);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.6;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color .3s, color .3s;
}

::selection { background: var(--accent); color: var(--accent-ink); }
a { color: inherit; text-decoration: none; }
img { display: block; }

.skip-link {
    position: absolute; left: 12px; top: -60px; z-index: 100;
    padding: 10px 16px; border-radius: 10px;
    background: var(--accent); color: var(--accent-ink); font-weight: 700;
}
.skip-link:focus, .skip-link:focus-visible { top: 12px; }

a:focus-visible, button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 10px;
}
.card:focus-visible { border-radius: var(--radius); }
#main:focus { outline: none; }

/* ---------- Pixel grid backdrop ---------- */
.grid-bg {
    position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background-image:
        linear-gradient(var(--grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 30%, transparent 100%);
    -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 30%, transparent 100%);
}

/* ---------- Nav ---------- */
.nav {
    position: sticky; top: 0; z-index: 20;
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    background: color-mix(in srgb, var(--bg) 78%, transparent);
    border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
.nav-inner {
    max-width: 1120px; margin: 0 auto; padding: 14px 24px;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--pixel); font-size: 1.15rem; letter-spacing: .02em; }
.brand-mark {
    width: 22px; height: 22px; border-radius: 4px;
    background: linear-gradient(var(--accent) 0 38%, var(--dirt) 38% 100%);
    box-shadow: inset 0 0 0 2px rgba(0,0,0,0.18);
    image-rendering: pixelated;
}
.nav-links { display: flex; align-items: center; gap: 6px; }
.nav-links > a:not(.nav-cta) {
    padding: 8px 12px; border-radius: 10px; color: var(--muted); font-size: .95rem;
    transition: color .2s, background-color .2s;
}
.nav-links > a:not(.nav-cta):hover { color: var(--text); background: var(--surface-2); }
.theme-toggle {
    width: 38px; height: 38px; border-radius: 10px; cursor: pointer;
    border: 1px solid var(--line); background: var(--surface); color: var(--text);
    font-size: 1rem; display: grid; place-items: center;
    transition: border-color .2s, transform .15s;
}
.theme-toggle:hover { border-color: var(--faint); }
.theme-toggle:active { transform: scale(.94); }
.nav-cta {
    margin-left: 4px; padding: 8px 14px; border-radius: 999px;
    background: var(--text); color: var(--bg); font-weight: 500; font-size: .92rem;
    transition: opacity .2s;
}
.nav-cta:hover { opacity: .85; }

/* ---------- Layout ---------- */
.container { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.section { padding: 56px 0; }
.section-head { display: flex; flex-direction: column; gap: 6px; margin-bottom: 24px; }
.section-tag, .status, .chip, .hero-label, .l-desc {
    font-family: var(--mono); font-size: .75rem; letter-spacing: .08em;
}
.section-tag { color: var(--faint); }
h1, h2, h3 { font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }

/* ---------- Hero ---------- */
.hero {
    display: grid; grid-template-columns: 1.3fr 1fr; align-items: center; gap: 40px;
    padding: 88px 0 48px;
}
.status {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px;
    color: var(--muted); background: var(--surface); margin-bottom: 24px;
}
.dot { width: 8px; height: 8px; border-radius: 2px; background: var(--accent); box-shadow: 0 0 10px var(--accent); animation: blink 2.4s steps(2) infinite; }
@keyframes blink { 50% { opacity: .35; } }
.hero h1 { font-size: clamp(2.4rem, 6vw, 4.1rem); max-width: 14ch; }
.hero-sub { margin-top: 20px; max-width: 46ch; color: var(--muted); font-size: 1.08rem; }
.hero-sub strong { color: var(--text); font-weight: 500; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 13px 20px; border-radius: 12px; font-weight: 500;
    transition: transform .15s, background-color .2s, border-color .2s, box-shadow .2s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 24px -10px var(--accent); }
.btn-primary:hover { box-shadow: 0 10px 30px -8px var(--accent); }
.btn-ghost { border: 1px solid var(--line); background: var(--surface); }
.btn-ghost:hover { border-color: var(--faint); }

/* isometric grass block */
.hero-art {
    position: relative; aspect-ratio: 1; max-width: 360px; width: 100%; justify-self: end;
    border: 1px solid var(--line); border-radius: var(--radius);
    background:
        radial-gradient(circle at 50% 45%, var(--accent-soft), transparent 62%),
        var(--surface);
    box-shadow: var(--shadow);
    display: grid; place-items: center; overflow: hidden;
}
.hero-label { position: absolute; left: 16px; bottom: 14px; color: var(--faint); }
.iso { perspective: 900px; }
.block {
    --s: 120px;
    position: relative; width: var(--s); height: var(--s);
    transform-style: preserve-3d;
    transform: rotateX(-30deg) rotateY(45deg);
    animation: spin 14s linear infinite;
}
@keyframes spin { to { transform: rotateX(-30deg) rotateY(405deg); } }
.face {
    position: absolute; inset: 0;
    image-rendering: pixelated;
    background-size: 25% 25%;
}
.face.top {
    transform: rotateX(90deg) translateZ(calc(var(--s) / 2));
    background-color: var(--accent);
    background-image:
        linear-gradient(45deg, rgba(0,0,0,.12) 25%, transparent 25%, transparent 75%, rgba(0,0,0,.12) 75%),
        linear-gradient(45deg, rgba(0,0,0,.12) 25%, transparent 25%, transparent 75%, rgba(0,0,0,.12) 75%);
    background-position: 0 0, 15px 15px;
    background-size: 30px 30px;
}
.face.bottom { transform: rotateX(-90deg) translateZ(calc(var(--s) / 2)); background: var(--dirt-dark); }
.face.side {
    background:
        linear-gradient(var(--accent) 0 22%, transparent 22%),
        repeating-linear-gradient(90deg, transparent 0 15px, rgba(0,0,0,.12) 15px 30px),
        linear-gradient(var(--dirt) 0 100%);
    backface-visibility: hidden;
}
.face.f1 { transform: translateZ(calc(var(--s) / 2)); }
.face.f2 { transform: rotateY(90deg) translateZ(calc(var(--s) / 2)); filter: brightness(.8); }
.face.f3 { transform: rotateY(180deg) translateZ(calc(var(--s) / 2)); }
.face.f4 { transform: rotateY(-90deg) translateZ(calc(var(--s) / 2)); filter: brightness(.8); }

/* ---------- Bento ---------- */
.bento { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; }
.card {
    grid-column: span 2;
    position: relative; display: flex; flex-direction: column;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); overflow: hidden; isolation: isolate;
    transition: border-color .25s, transform .25s;
}
.card-wide { grid-column: span 4; flex-direction: row; }
.card::after {
    content: ''; position: absolute; inset: 0; z-index: -1; opacity: 0; transition: opacity .3s;
    background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), var(--accent-soft), transparent 60%);
}
.card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); transform: translateY(-2px); }
.card:hover::after { opacity: 1; }

.card-visual {
    position: relative; min-height: 180px; display: grid; place-items: center;
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
    background-image:
        linear-gradient(var(--grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    background-size: 16px 16px;
}
.card-wide .card-visual { flex: 0 0 46%; border-bottom: 0; border-right: 1px solid var(--line); min-height: 260px; }
.card-body { padding: 24px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card-wide .card-body { justify-content: center; padding: 32px; }
.chip {
    align-self: flex-start; padding: 4px 8px; border-radius: 6px;
    color: var(--accent); background: var(--accent-soft);
}
.card h3 { font-size: 1.45rem; text-transform: uppercase; letter-spacing: -0.01em; }
.card-wide h3 { font-size: 1.9rem; }
.card p { color: var(--muted); font-size: .98rem; }
.card-link { margin-top: auto; padding-top: 8px; font-weight: 500; font-size: .95rem; display: inline-flex; gap: 6px; }
.arrow { transition: transform .2s; }
.card:hover .arrow, .links a:hover .arrow { transform: translateX(3px); }

/* painter visual */
#paintCanvas {
    width: 160px; height: 160px; image-rendering: pixelated;
    border-radius: 8px; box-shadow: 0 12px 30px -12px rgba(0,0,0,.6);
}

/* crafting visual */
.visual-craft { display: flex; align-items: center; justify-content: center; gap: 14px; }
.craft-grid { display: grid; grid-template-columns: repeat(3, 26px); gap: 4px; }
.craft-grid i, .craft-out {
    width: 26px; height: 26px; border-radius: 4px;
    background: var(--bg); border: 1px solid var(--line);
}
.craft-grid i.on { background: var(--dirt); border-color: var(--dirt-dark); box-shadow: inset 0 -4px 0 rgba(0,0,0,.2); }
.craft-arrow { color: var(--faint); font-family: var(--mono); }
.craft-out { width: 40px; height: 40px; background: linear-gradient(var(--accent) 0 35%, var(--dirt) 35%); border: 0; }
.card:hover .craft-grid i.on { animation: pop .5s ease both; }
.card:hover .craft-grid i.on:nth-child(4) { animation-delay: .06s; }
.card:hover .craft-grid i.on:nth-child(5) { animation-delay: .12s; }
.card:hover .craft-grid i.on:nth-child(6) { animation-delay: .18s; }
.card:hover .craft-grid i.on:nth-child(8) { animation-delay: .24s; }
@keyframes pop { 50% { transform: scale(.75); opacity: .4; } }

/* model wireframe */
.wire-scene { perspective: 600px; }
.wire {
    --w: 70px; width: var(--w); height: var(--w); position: relative;
    transform-style: preserve-3d; transform: rotateX(-24deg) rotateY(35deg);
    transition: transform 1.2s cubic-bezier(.2,.7,.2,1);
}
.card:hover .wire { transform: rotateX(-24deg) rotateY(215deg); }
.wire i { position: absolute; inset: 0; border: 1.5px solid var(--accent); background: var(--accent-soft); }
.wire i:nth-child(1) { transform: translateZ(calc(var(--w) / 2)); }
.wire i:nth-child(2) { transform: rotateY(180deg) translateZ(calc(var(--w) / 2)); }
.wire i:nth-child(3) { transform: rotateY(90deg) translateZ(calc(var(--w) / 2)); }
.wire i:nth-child(4) { transform: rotateY(-90deg) translateZ(calc(var(--w) / 2)); }
.wire i:nth-child(5) { transform: rotateX(90deg) translateZ(calc(var(--w) / 2)); }
.wire i:nth-child(6) { transform: rotateX(-90deg) translateZ(calc(var(--w) / 2)); }

/* pdf visual */
.doc {
    width: 150px; height: 190px; padding: 22px 18px; border-radius: 8px;
    background: #f6f4ee; box-shadow: 0 16px 36px -14px rgba(0,0,0,.6);
    display: flex; flex-direction: column; gap: 10px; transform: rotate(-4deg);
    transition: transform .4s;
}
.card:hover .doc { transform: rotate(0deg) translateY(-4px); }
.doc i { height: 7px; width: 100%; border-radius: 4px; background: #d9d5ca; }
.doc .sig {
    margin-top: auto; align-self: flex-end;
    font-family: 'Brush Script MT', 'Segoe Script', cursive; font-size: 1.15rem; color: #2b5fd9;
    border-bottom: 1.5px solid #c9c4b6; padding: 0 2px;
}

/* ---------- Find me ---------- */
.links { list-style: none; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.links li + li { border-top: 1px solid var(--line); }
.links a {
    display: grid; grid-template-columns: 28px 160px 1fr auto; align-items: center; gap: 16px;
    padding: 18px 24px; transition: background-color .2s;
}
.links a:hover { background: var(--surface-2); }
.links img { width: 28px; height: 28px; object-fit: contain; border-radius: 6px; }
.l-name { font-weight: 500; font-size: 1.05rem; }
.l-desc { color: var(--faint); letter-spacing: .02em; }
.links .arrow { color: var(--muted); }

/* ---------- Footer ---------- */
.footer {
    display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px;
    padding: 32px 0 48px; margin-top: 24px; border-top: 1px solid var(--line);
    color: var(--muted); font-size: .9rem;
}
.footer-dim { color: var(--faint); }

/* ---------- Toasts ---------- */
.toast-stack { position: fixed; right: 16px; bottom: 16px; z-index: 50; display: flex; flex-direction: column; gap: 10px; }
.toast {
    display: flex; align-items: center; gap: 12px; cursor: pointer;
    padding: 12px 16px 12px 12px; border-radius: 14px; min-width: 240px;
    background: var(--surface); border: 1px solid var(--line); box-shadow: 0 18px 40px -16px rgba(0,0,0,.6);
    transform: translateY(14px); opacity: 0; transition: transform .35s, opacity .35s;
}
.toast.show { transform: none; opacity: 1; }
.toast-icon { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); font-size: 1.1rem; }
.toast-text { display: flex; flex-direction: column; line-height: 1.3; }
.toast-text strong { font-family: var(--pixel); color: var(--accent); font-weight: 600; font-size: .9rem; }
.toast-text small { color: var(--muted); font-size: .85rem; }

/* ---------- Reveal ---------- */
[data-reveal] { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; transition-delay: var(--delay, 0ms); }
[data-reveal].revealed { opacity: 1; transform: none; }
.card[data-reveal].revealed { transition: opacity .6s ease var(--delay, 0ms), transform .25s, border-color .25s; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .hero { grid-template-columns: 1fr; padding-top: 56px; }
    .hero-art { justify-self: start; max-width: 100%; aspect-ratio: 4 / 3; }
    .block { --s: 96px; }
    .bento { grid-template-columns: 1fr 1fr; }
    .card, .card-wide { grid-column: span 1; flex-direction: column; }
    .card-wide { grid-column: span 2; }
    .card-wide .card-visual { flex: none; border-right: 0; border-bottom: 1px solid var(--line); min-height: 250px; }
}
@media (max-width: 600px) {
    .nav-inner { padding: 12px 16px; }
    .nav-links > a:not(.nav-cta) { display: none; }
    .container { padding: 0 16px; }
    .bento { grid-template-columns: 1fr; }
    .card, .card-wide { grid-column: span 1; }
    .card-wide .card-body { padding: 24px; }
    .card-wide h3 { font-size: 1.45rem; }
    .links a { grid-template-columns: 28px 1fr auto; padding: 16px; }
    .l-desc { display: none; }
    .section { padding: 40px 0; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    [data-reveal] { opacity: 1; transform: none; }
    html { scroll-behavior: auto; }
}
