/* ==========================================================================
   Canvasy — design tokens
   Palette drawn from real pigment names: paper, ink, cadmium, phthalo,
   alizarin, sap green. Fraunces for display type (has real personality
   without being a generic "AI serif"), Work Sans for UI/body.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,600;0,9..144,700;1,9..144,500&family=Work+Sans:wght@400;500;600;700&display=swap');

:root {
    --paper: #FAF6EE;
    --paper-dim: #F1EADA;
    --ink: #211C15;
    --ink-soft: #57503F;
    --cadmium: #F2A93B;
    --cadmium-deep: #D98A1F;
    --phthalo: #1C5D6B;
    --phthalo-deep: #133F49;
    --alizarin: #B23A48;
    --sap: #5C7A4A;
    --line: rgba(33, 28, 21, 0.14);
    --shadow: rgba(33, 28, 21, 0.18);

    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'Work Sans', -apple-system, Segoe UI, sans-serif;

    --radius: 6px;
    --max-width: 1180px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

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

a { color: var(--phthalo); text-decoration: none; }
a:hover { color: var(--phthalo-deep); text-decoration: underline; }

:focus-visible {
    outline: 3px solid var(--cadmium-deep);
    outline-offset: 2px;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.15;
    margin: 0 0 0.5em;
    color: var(--ink);
}

h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); font-weight: 700; }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
h3 { font-size: 1.25rem; }

p { margin: 0 0 1em; color: var(--ink-soft); }

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

/* ---------- Buttons & form controls ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 11px 22px;
    border-radius: var(--radius);
    border: 2px solid var(--ink);
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.12s ease, background 0.12s ease, color 0.12s ease;
}
.btn:hover { background: var(--ink); color: var(--paper); text-decoration: none; transform: translateY(-1px); }

.btn-primary {
    background: var(--alizarin);
    border-color: var(--alizarin);
    color: #fff;
}
.btn-primary:hover { background: #94222f; border-color: #94222f; color: #fff; }

.btn-ghost {
    border-color: var(--line);
    color: var(--ink-soft);
}
.btn-ghost:hover { background: var(--ink-soft); border-color: var(--ink-soft); }

.btn-small { padding: 7px 14px; font-size: 0.85rem; }

input[type=text], input[type=email], input[type=password], input[type=search],
textarea, select {
    width: 100%;
    font-family: var(--font-body);
    font-size: 1rem;
    padding: 12px 14px;
    border: 2px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    color: var(--ink);
}
input:focus, textarea:focus, select:focus {
    border-color: var(--phthalo);
    outline: none;
}
label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin: 0 0 6px;
    color: var(--ink);
}
.field { margin-bottom: 18px; }
.help-text { font-size: 0.85rem; color: var(--ink-soft); margin-top: 4px; }

/* ---------- Site header ---------- */

.site-header {
    border-bottom: 3px solid var(--ink);
    background: var(--paper);
    position: sticky;
    top: 0;
    z-index: 20;
}
.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 74px;
    gap: 20px;
}
.brand {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.6rem;
    color: var(--ink);
    display: flex;
    align-items: baseline;
    gap: 2px;
    letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; }
.brand .dot { color: var(--alizarin); font-size: 1.3rem; }

.nav-links {
    display: flex;
    align-items: center;
    gap: 22px;
    font-weight: 500;
}
.nav-links a { color: var(--ink); }
.nav-links a:hover { color: var(--alizarin); text-decoration: none; }

.search-form { flex: 1; max-width: 360px; }
.search-form input { padding: 9px 14px; }

/* ---------- Mobile header ---------- */
/* Below this width the header wraps to two rows: brand + nav (scrollable
   if it overflows) on top, search field full-width underneath. Keeps every
   nav item reachable without a hamburger menu or hidden functionality. */
@media (max-width: 760px) {
    .site-header .container {
        flex-wrap: wrap;
        height: auto;
        padding-top: 12px;
        padding-bottom: 10px;
        row-gap: 10px;
    }
    .brand { order: 1; }
    .nav-links {
        order: 2;
        flex: 1 1 auto;
        justify-content: flex-end;
        gap: 14px;
        font-size: 0.9rem;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .nav-links::-webkit-scrollbar { display: none; }
    .search-form { order: 3; flex: 1 1 100%; max-width: 100%; }
}
@media (max-width: 420px) {
    .container { padding: 0 16px; }
    .brand { font-size: 1.35rem; }
    .nav-links { gap: 10px; font-size: 0.85rem; }
}

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

.hero {
    padding: 64px 0 48px;
    border-bottom: 1px solid var(--line);
}
.hero-swatches {
    display: flex;
    gap: 8px;
    margin-bottom: 22px;
}
.swatch {
    width: 34px; height: 34px; border-radius: 50%;
    border: 2px solid var(--ink);
}
.hero h1 { max-width: 14ch; }
.hero .lede {
    font-size: 1.15rem;
    max-width: 46ch;
    color: var(--ink-soft);
}
.hero-actions { display: flex; gap: 14px; margin-top: 26px; flex-wrap: wrap; }

/* ---------- Gallery grid (masonry via CSS columns) ---------- */

.gallery {
    columns: 4 260px;
    column-gap: 18px;
    padding: 40px 0 60px;
}
@media (max-width: 700px) { .gallery { columns: 2 160px; } }
@media (max-width: 420px) { .gallery { columns: 1; } }

.art-card {
    break-inside: avoid;
    margin-bottom: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    background: #fff;
    transition: box-shadow 0.15s ease;
}
.art-card:hover { box-shadow: 0 6px 18px var(--shadow); }
.art-card img { width: 100%; }
.art-card .meta {
    padding: 10px 12px 12px;
}
.art-card .art-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1rem;
    margin: 0 0 4px;
}
.art-card .art-by {
    font-size: 0.85rem;
    color: var(--ink-soft);
}
.badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    margin-left: 6px;
}
.badge-private { background: var(--alizarin); color: #fff; }
.badge-group { background: var(--phthalo); color: #fff; }

/* ---------- Sections / cards generic ---------- */

.section-title-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-top: 40px;
}

.panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 28px;
}

.auth-wrap {
    max-width: 420px;
    margin: 60px auto;
}
.auth-wrap .panel { padding: 34px; }

.flash {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-weight: 500;
}
.flash-error { background: #FBE4E4; color: #7A2530; border: 1px solid var(--alizarin); }
.flash-success { background: #E7EFE1; color: #37502B; border: 1px solid var(--sap); }

/* ---------- Artwork detail page ---------- */

.art-detail {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 40px;
    padding: 40px 0 60px;
}
@media (max-width: 800px) { .art-detail { grid-template-columns: 1fr; } }
.art-detail img { border-radius: var(--radius); border: 1px solid var(--line); width: 100%; }
.tag-list { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.tag {
    font-size: 0.8rem;
    padding: 4px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink-soft);
}

/* ---------- Groups ---------- */

.group-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    background: #fff;
    margin-bottom: 14px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

/* Two-column layout used for side-by-side forms/panels (create/join group,
   admin dashboard summary panels) — stacks to one column on narrower
   screens rather than squeezing both columns down to an unreadable width. */
.two-col-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}
@media (max-width: 700px) {
    .two-col-grid { grid-template-columns: 1fr; }
}

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

.site-footer {
    border-top: 3px solid var(--ink);
    padding: 32px 0;
    margin-top: 40px;
    font-size: 0.9rem;
    color: var(--ink-soft);
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.site-footer a { color: var(--ink-soft); }

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

.upload-dropzone {
    border: 2px dashed var(--line);
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
    background: #fff;
    color: var(--ink-soft);
    margin-bottom: 20px;
}
