/* ==========================================================================
   DANDYAPP design system
   Hand-written design system for DANDYAPP.
   No Tailwind, no icon font - nothing render-blocking except Poppins.
   ========================================================================== */

/* --- Tokens --------------------------------------------------------------- */

:root {
    --paper:      #f3f4f6;   /* outer page ground */
    --slab:       #f8fafc;   /* the floating panel */
    --white:      #ffffff;
    --ink:        #111827;
    --muted:      #6b7280;
    --faint:      #9ca3af;
    --hairline:   #f3f4f6;
    --border:     #e5e7eb;
    --footer:     #09090b;
    --footer-2:   #27272a;

    --ok:         #16a34a;
    --warn:       #b45309;
    --bad:        #dc2626;
    --add:        #dcfce7;
    --del:        #fee2e2;

    --r-outer:    2rem;
    --r-inner:    1.5rem;
    --r-pill:     999px;

    --shadow-sm:  0 1px 2px 0 rgb(0 0 0 / .05);
    --shadow:     0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);
    --shadow-lg:  0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);
    --shadow-xl:  0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / .25);

    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

    /* Width of the content column. A single hard cap leaves enormous dead
       gutters on a large monitor, so it steps up with the viewport instead. */
    --page: 100rem;      /* 1600px */
}

@media (min-width: 768px) {
    :root { --r-outer: 2.5rem; }
}

@media (min-width: 1800px) { :root { --page: 112rem; } }   /* 1792px */
@media (min-width: 2200px) { :root { --page: 124rem; } }   /* 1984px */

/* --- Reset ---------------------------------------------------------------- */

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

* { margin: 0; }

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

body {
    font-family: Poppins, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    background-color: var(--paper);
    color: var(--ink);
    line-height: 1.5;
    overflow-x: hidden;
    padding: .5rem;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

@media (min-width: 640px) { body { padding: 1rem; } }

img, svg { display: block; max-width: 100%; }

/* Every SVG on the site is an inline icon from Dandy.icon(). Without an
   intrinsic size they default to 300x150, so they track the text size unless
   a more specific rule below says otherwise. */
svg { width: 1em; height: 1em; flex: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
table { border-collapse: collapse; width: 100%; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* --- Typography ----------------------------------------------------------- */

h1, h2, h3, h4 { font-weight: 900; letter-spacing: -.05em; line-height: 1.05; }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.eyebrow {
    font-size: .6875rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .14em; color: var(--faint);
}

.lede { font-weight: 300; color: var(--muted); line-height: 1.75; }

.mono { font-family: var(--mono); font-size: .8125rem; }

/* --- Layout --------------------------------------------------------------- */

.slab {
    background: var(--slab);
    border-radius: var(--r-inner);
    box-shadow: var(--shadow-2xl);
    overflow: hidden;
    position: relative;
}

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

.section { padding: 4rem 1.5rem; }
@media (min-width: 768px) { .section { padding: 6rem 2rem; } }

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

.site-header {
    position: absolute; inset: 0 0 auto 0; z-index: 50;
    display: flex; align-items: center; gap: 1rem;
    padding: 1rem;
}
@media (min-width: 768px) { .site-header { padding: 1.5rem; gap: 2rem; } }

.wordmark {
    font-size: 1.25rem; font-weight: 900; letter-spacing: -.05em;
    white-space: nowrap; z-index: 50;
}
@media (min-width: 768px) { .wordmark { font-size: 1.5rem; } }
.wordmark span { color: var(--faint); }

.pill-nav {
    display: none; align-items: center; gap: .25rem;
    background: rgb(248 250 252 / .8);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    padding: .25rem; border-radius: var(--r-pill);
    border: 1px solid var(--hairline); box-shadow: var(--shadow-sm);
}
/* 1120px, not 1024px: the nav plus the credit item plus the CTA needs the room. */
@media (min-width: 1120px) { .pill-nav { display: flex; } }

.pill-nav a {
    padding: .5rem 1.25rem; border-radius: var(--r-pill);
    font-size: .875rem; font-weight: 500; white-space: nowrap;
    transition: background-color .2s, color .2s;
}
.pill-nav a:hover { background: #f3f4f6; }
.pill-nav a[aria-current="page"] {
    background: var(--ink); color: var(--white); box-shadow: var(--shadow);
}

/* The outbound credit reads as an attribution, not another section of the
   site, so it sits behind a hairline and starts muted. */
.pill-nav .sep { width: 1px; align-self: stretch; background: var(--border); margin: .25rem .375rem; }
.pill-nav a.credit { color: var(--muted); display: inline-flex; align-items: center; gap: .375rem; }
.pill-nav a.credit svg { width: .6875rem; height: .6875rem; opacity: .7; }
.pill-nav a.credit:hover { color: var(--ink); background: #f3f4f6; }
.pill-nav a.credit:hover svg { opacity: 1; }


.rule { flex: 1; height: 1px; background: var(--ink); display: none; }
@media (min-width: 1280px) { .rule { display: block; } }

.header-cta {
    display: none; align-items: center; margin-left: auto;
    background: var(--ink); border-radius: var(--r-outer);
    padding: .375rem; box-shadow: var(--shadow-lg);
}
@media (min-width: 640px) { .header-cta { display: flex; } }
@media (min-width: 768px) { .header-cta { padding: .5rem; } }

.header-cta a {
    display: flex; align-items: center; gap: .5rem;
    background: var(--slab); color: var(--ink);
    padding: .5rem 1rem; border-radius: var(--r-inner);
    font-weight: 600; font-size: .75rem; white-space: nowrap;
    transition: background-color .2s;
}
.header-cta a:hover { background: #f3f4f6; }
@media (min-width: 768px) { .header-cta a { padding: .75rem 1.5rem; font-size: .875rem; } }

/* --- Burger + drawer (below the pill nav's breakpoint) --------------------- */

.burger {
    display: none; margin-left: auto; flex: none;
    width: 2.75rem; height: 2.75rem; border-radius: var(--r-pill);
    background: var(--white); border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    align-items: center; justify-content: center;
    transition: background-color .2s, border-color .2s;
    z-index: 60;
}
@media (max-width: 1119px) { .burger { display: inline-flex; } }
@media (min-width: 640px)  { .burger { margin-left: .625rem; } }
.burger:hover { border-color: var(--faint); }

.burger .bars { display: block; width: 1.0625rem; height: .75rem; position: relative; }
.burger .bars i {
    position: absolute; left: 0; width: 100%; height: 2px; border-radius: 2px;
    background: var(--ink);
    transition: transform .25s ease, opacity .2s ease, top .25s ease;
}
.burger .bars i:nth-child(1) { top: 0; }
.burger .bars i:nth-child(2) { top: 5px; }
.burger .bars i:nth-child(3) { top: 10px; }

.burger.is-open .bars i:nth-child(1) { top: 5px; transform: rotate(45deg); }
.burger.is-open .bars i:nth-child(2) { opacity: 0; }
.burger.is-open .bars i:nth-child(3) { top: 5px; transform: rotate(-45deg); }

.nav-drawer {
    position: fixed; inset: 0; z-index: 400;
    background: rgb(17 24 39 / .45);
    -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
    opacity: 0; pointer-events: none;
    transition: opacity .25s ease;
}
.nav-drawer.open { opacity: 1; pointer-events: auto; }
@media (min-width: 1120px) { .nav-drawer { display: none; } }

.drawer-panel {
    position: absolute; top: .5rem; right: .5rem; left: .5rem;
    background: var(--slab); border-radius: var(--r-outer);
    padding: 1rem; box-shadow: var(--shadow-2xl);
    transform: translateY(-1rem); opacity: 0;
    transition: transform .28s cubic-bezier(.16, 1, .3, 1), opacity .2s ease;
    max-height: calc(100svh - 1rem); overflow-y: auto;
}
.nav-drawer.open .drawer-panel { transform: none; opacity: 1; }

.drawer-top {
    display: flex; align-items: center; justify-content: space-between;
    padding: .25rem .5rem 1rem;
}
.drawer-close {
    width: 2.25rem; height: 2.25rem; border-radius: var(--r-pill);
    border: 1px solid var(--border); background: var(--white);
    display: flex; align-items: center; justify-content: center;
}
.drawer-close svg { width: 1rem; height: 1rem; }
.drawer-close:hover { background: #f3f4f6; }

.drawer-links { display: flex; flex-direction: column; gap: .375rem; }
.drawer-links a {
    display: flex; align-items: center; justify-content: space-between;
    padding: .875rem 1.125rem; border-radius: var(--r-inner);
    background: var(--white); border: 1px solid var(--border);
    font-size: 1rem; font-weight: 600;
    transition: background-color .2s, color .2s, border-color .2s;
}
.drawer-links a svg { width: .9375rem; height: .9375rem; color: var(--faint); }
.drawer-links a:hover { border-color: var(--faint); }
.drawer-links a[aria-current="page"] {
    background: var(--ink); color: var(--white); border-color: var(--ink);
}
.drawer-links a[aria-current="page"] svg { color: var(--white); }
.drawer-links a.credit { color: var(--muted); font-weight: 500; background: transparent; }
.drawer-links a.credit:hover { color: var(--ink); background: var(--white); }

.drawer-cta {
    display: flex; align-items: center; justify-content: center; gap: .5rem;
    margin-top: .75rem; padding: 1rem;
    background: var(--ink); color: var(--white);
    border-radius: var(--r-inner);
    font-size: .875rem; font-weight: 700; letter-spacing: .02em;
}
.drawer-cta:hover { background: #000; }

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

.hero {
    position: relative; overflow: hidden;
    min-height: 100svh;
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 8rem 1rem 2rem;
    background-image: url("../assets/background.webp");
    background-size: cover; background-position: center;
}
@media (min-width: 768px) { .hero { padding: 8rem 2rem 2rem; } }

.hero-scrim {
    position: absolute; inset: 0; z-index: 0;
    background: rgb(248 250 252 / .6);
    -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}

.hero-type {
    position: absolute; inset: 0; z-index: 10;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    pointer-events: none; user-select: none;
}
.hero-type .line-1 {
    font-size: 22vw; font-weight: 900; letter-spacing: -.05em;
    line-height: 1; color: var(--ink); opacity: .1;
}
.hero-type .line-2 {
    font-size: 16vw; font-weight: 900; letter-spacing: -.025em;
    line-height: 1; margin-top: -8vw; position: relative; z-index: 20;
}
@media (min-width: 768px) {
    .hero-type .line-1 { font-size: 15vw; }
    .hero-type .line-2 { font-size: 12vw; margin-top: -6vw; }
}

.hero-foot { position: relative; z-index: 30; margin-top: auto; }

.hero-card {
    max-width: 20rem;
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    background: rgb(248 250 252 / .45);
    padding: 1.25rem; border-radius: var(--r-inner);
}
.hero-card h2 { font-size: 1.125rem; margin-bottom: .5rem; line-height: 1.2; }
.hero-card p { font-size: .75rem; color: var(--muted); line-height: 1.7; margin-bottom: 1rem; }

/* The "See More" arrow affordance */
.arrow-link { display: inline-flex; align-items: center; gap: .75rem; }
.arrow-link .label {
    font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
}
.arrow-link .track { display: flex; align-items: center; }
.arrow-link .track i {
    display: block; width: 2rem; height: 1px; background: var(--ink);
    transition: width .3s;
}
.arrow-link:hover .track i { width: 3rem; }
.arrow-link .knob {
    width: 1.5rem; height: 1.5rem; border-radius: 50%;
    border: 1px solid var(--ink); border-right-color: transparent;
    display: flex; align-items: center; justify-content: center;
    margin-left: -.25rem; transition: background-color .3s, color .3s;
}
.arrow-link:hover .knob { background: var(--ink); color: var(--white); border-right-color: var(--ink); }
.arrow-link .knob svg { width: .625rem; height: .625rem; }

/* --- Reveal --------------------------------------------------------------- */

.reveal { opacity: 0; transform: translateX(50px); transition: opacity 1s ease-out, transform 1s ease-out; }
.reveal.active { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
    .reveal { opacity: 1; transform: none; transition: none; }
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

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

.card-grid {
    display: grid; gap: 1.5rem;
    grid-template-columns: 1fr;
}
@media (min-width: 900px) { .card-grid { grid-template-columns: repeat(3, 1fr); } }

.tool-card {
    display: block; background: var(--ink);
    border-radius: var(--r-outer); padding: .5rem;
    box-shadow: var(--shadow-xl);
    transition: transform .3s ease, box-shadow .3s ease;
}
.tool-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-2xl); }

.tool-card > .body {
    background: var(--white); border-radius: var(--r-inner);
    padding: 2rem; height: 100%;
    display: flex; flex-direction: column;
}
.tool-card .badge {
    display: inline-flex; align-items: center; gap: .5rem;
    font-size: .6875rem; font-weight: 700; letter-spacing: .12em;
    text-transform: uppercase; color: var(--faint); margin-bottom: 1.25rem;
}
.tool-card h3 { font-size: 1.75rem; margin-bottom: .5rem; }
.tool-card p { font-size: .875rem; color: var(--muted); font-weight: 300; line-height: 1.7; }
.tool-card ul { list-style: none; padding: 0; margin: 1.5rem 0 0; }
.tool-card li {
    font-size: .8125rem; color: var(--muted); padding: .375rem 0;
    display: flex; gap: .625rem; align-items: flex-start;
}
.tool-card li svg { width: .875rem; height: .875rem; flex: none; margin-top: .3rem; color: var(--ink); }
.tool-card .go {
    margin-top: 1.75rem; padding-top: 1.25rem; border-top: 1px solid var(--hairline);
    display: flex; align-items: center; justify-content: space-between;
    font-size: .8125rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
}
.tool-card .go svg { width: 1rem; height: 1rem; transition: transform .3s; }
.tool-card:hover .go svg { transform: translateX(.375rem); }

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

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    padding: .625rem 1.25rem; border-radius: var(--r-pill);
    border: 1px solid var(--border); background: var(--white);
    font-size: .8125rem; font-weight: 600; white-space: nowrap;
    transition: background-color .2s, border-color .2s, color .2s, transform .1s;
}
.btn:hover { background: #f9fafb; border-color: var(--faint); }
.btn:active { transform: translateY(1px); }
.btn svg { width: .9375rem; height: .9375rem; flex: none; }

.btn-dark { background: var(--ink); color: var(--white); border-color: var(--ink); }
.btn-dark:hover { background: #000; border-color: #000; }

.btn-danger { color: var(--bad); border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; border-color: var(--bad); }

.btn-sm { padding: .375rem .75rem; font-size: .75rem; }

.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; }

/* --- Forms ---------------------------------------------------------------- */

.field { display: block; margin-bottom: 1rem; }
.field > span {
    display: block; font-size: .6875rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .08em;
    color: var(--muted); margin-bottom: .375rem;
}

input[type="text"], input[type="email"], input[type="date"], input[type="number"],
input[type="search"], input[type="tel"], select, textarea {
    width: 100%; padding: .625rem .875rem;
    border: 1px solid var(--border); border-radius: .75rem;
    background: var(--white); font-size: .875rem;
    transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--ink);
    box-shadow: 0 0 0 3px rgb(17 24 39 / .06);
}
textarea { resize: vertical; min-height: 6rem; line-height: 1.6; }

.field-row { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 560px) { .field-row.two { grid-template-columns: 1fr 1fr; } }
@media (min-width: 760px) { .field-row.three { grid-template-columns: repeat(3, 1fr); } }

.code-area {
    font-family: var(--mono); font-size: .8125rem; line-height: 1.6;
    min-height: 11rem; white-space: pre; overflow-wrap: normal; overflow-x: auto;
    tab-size: 2;
}

.check { display: inline-flex; align-items: center; gap: .5rem; font-size: .8125rem; cursor: pointer; }
.check input { width: 1rem; height: 1rem; accent-color: var(--ink); cursor: pointer; }

/* Segmented control - the pill-nav motif at component scale */
.segmented {
    display: inline-flex; gap: .25rem; padding: .25rem;
    background: #f3f4f6; border-radius: var(--r-pill);
}
.segmented button {
    padding: .375rem 1rem; border-radius: var(--r-pill);
    font-size: .75rem; font-weight: 600; color: var(--muted);
    transition: background-color .2s, color .2s;
}
.segmented button[aria-pressed="true"] {
    background: var(--white); color: var(--ink); box-shadow: var(--shadow-sm);
}

/* --- Status / notes ------------------------------------------------------- */

.note {
    display: flex; gap: .625rem; align-items: flex-start;
    padding: .75rem 1rem; border-radius: .75rem;
    font-size: .8125rem; line-height: 1.6;
}
.note svg { width: 1rem; height: 1rem; flex: none; margin-top: .15rem; }
.note-info { background: #f3f4f6; color: var(--muted); }
.note-warn { background: #fffbeb; color: var(--warn); }
.note-bad  { background: #fef2f2; color: var(--bad); }
.note-ok   { background: #f0fdf4; color: var(--ok); }
.note[hidden] { display: none; }

.tag {
    display: inline-flex; align-items: center; gap: .375rem;
    padding: .1875rem .625rem; border-radius: var(--r-pill);
    font-size: .6875rem; font-weight: 700; letter-spacing: .04em;
}
.tag-ok  { background: #dcfce7; color: #15803d; }
.tag-bad { background: #fee2e2; color: #b91c1c; }
.tag-neutral { background: #f3f4f6; color: var(--muted); }

/* --- Toast ---------------------------------------------------------------- */

#toast {
    position: fixed; left: 50%; bottom: 1.5rem; z-index: 200;
    transform: translate(-50%, 1.5rem);
    background: var(--ink); color: var(--white);
    padding: .625rem 1.25rem; border-radius: var(--r-pill);
    font-size: .8125rem; font-weight: 600; box-shadow: var(--shadow-xl);
    opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* --- Footer --------------------------------------------------------------- */

.site-footer {
    background: var(--footer); color: var(--white);
    border-radius: var(--r-outer);
    margin: 1rem; padding: 4rem 1.5rem 2rem;
}
@media (min-width: 768px) { .site-footer { padding: 5rem 2rem 2rem; } }

.footer-top {
    max-width: var(--page); margin: 0 auto 3rem;
    display: flex; flex-direction: column; gap: 2rem;
    align-items: flex-start; justify-content: space-between;
}
@media (min-width: 768px) { .footer-top { flex-direction: row; align-items: center; } }

.footer-top h2 { font-size: 2.5rem; margin-bottom: 1rem; }
@media (min-width: 768px) { .footer-top h2 { font-size: 3rem; } }
.footer-top p { color: #9ca3af; font-size: .875rem; line-height: 1.7; max-width: 28rem; }

.footer-links {
    display: flex; flex-wrap: wrap; gap: 1rem;
    font-size: .75rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: .08em; color: #9ca3af;
}
.footer-links a:hover { color: var(--white); }

.footer-credit {
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .625rem 1.125rem; border-radius: var(--r-pill);
    border: 1px solid var(--footer-2); color: #d4d4d8;
    font-size: .8125rem; font-weight: 600;
    transition: background-color .2s, color .2s, border-color .2s;
}
.footer-credit:hover { background: var(--white); color: var(--footer); border-color: var(--white); }
.footer-credit svg { width: .8125rem; height: .8125rem; }

.footer-bottom {
    border-top: 1px solid var(--footer-2); padding-top: 2rem;
    max-width: 56rem; margin: 0 auto; text-align: center;
}
.footer-bottom p { font-size: .6875rem; color: #52525b; line-height: 1.7; }
.footer-bottom p + p { margin-top: .75rem; }

/* --- Utilities (a deliberately tiny set) ---------------------------------- */

.stack   { display: flex; flex-direction: column; }
.row     { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.grow    { flex: 1; }
.right   { text-align: right; }
.muted   { color: var(--muted); }
.faint   { color: var(--faint); }
.nowrap  { white-space: nowrap; }
.hidden  { display: none !important; }
.mt-1 { margin-top: .5rem; }  .mt-2 { margin-top: 1rem; }  .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; }
