/* LacquerIndex -- flat, minimal, a little 2000s-profile-page in spirit */

:root {
    --ink: #1c1a22;
    --ink-soft: #5b5566;
    --card: #ffffff;
    --line: #e7e2ee;
    --violet: #6c4fd1;
    --success: #2f8f5b;
    --success-bg: #e7f6ee;
    --error: #c1392f;
    --error-bg: #fbe9e7;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(28, 26, 34, 0.06), 0 4px 16px rgba(28, 26, 34, 0.05);

    /* Default theme: Classic Pink. Overridden per html[data-theme-color]
       below -- keep slugs in sync with lib/theme.php THEMES. --paper/
       --paper-2 are two faint theme-tinted variants that drift into each
       other on the page background (see the animated gradient on body,
       below); --card stays plain white everywhere so text on cards is
       never affected by theming. --header-bg-1/2 are deliberately darker
       than --accent/--accent-2 (which stay vivid, since those also color
       links/buttons on white cards) so the header reads as a distinct,
       deeper band. */
    --accent: #b3457a;
    --accent-2: #e0729e;
    --accent-ink: #ffffff;
    --accent-soft: #f6e6ee;
    --paper: #fdf6f9;
    --paper-2: #fbeef3;
    --header-bg-1: #7a2c54;
    --header-bg-2: #b3457a;
    --header-ink: #ffffff;
    --header-ink-soft: rgba(255, 255, 255, 0.82);
    --header-line: rgba(255, 255, 255, 0.25);
}

html[data-theme-color="pink-classic"] {
    --accent: #b3457a;
    --accent-2: #e0729e;
    --accent-soft: #f6e6ee;
    --paper: #fdf6f9;
    --paper-2: #fbeef3;
    --header-bg-1: #7a2c54;
    --header-bg-2: #b3457a;
}
html[data-theme-color="purple-holo"] {
    --accent: #7b2ff7;
    --accent-2: #d946ef;
    --accent-soft: #f1e6fd;
    --paper: #faf7ff;
    --paper-2: #fdf3fa;
    --header-bg-1: #4c1a9e;
    --header-bg-2: #7b2ff7;
}
html[data-theme-color="red-creme"] {
    --accent: #c81d3f;
    --accent-2: #ff6b6b;
    --accent-soft: #fde8ea;
    --paper: #fff6f6;
    --paper-2: #fff0eb;
    --header-bg-1: #7a0f26;
    --header-bg-2: #c81d3f;
}
html[data-theme-color="rose-gold"] {
    --accent: #b8763f;
    --accent-2: #d88a97;
    --accent-soft: #f9ece3;
    --paper: #fff9f5;
    --paper-2: #fdf3f0;
    --header-bg-1: #7a4a22;
    --header-bg-2: #b8763f;
}
html[data-theme-color="teal-duo"] {
    --accent: #0f9b8e;
    --accent-2: #3a6cf6;
    --accent-soft: #e2f6f3;
    --paper: #f2fbfa;
    --paper-2: #eef4fd;
    --header-bg-1: #0a5f57;
    --header-bg-2: #0f9b8e;
}
html[data-theme-color="black-multichrome"] {
    --accent: #2a2a35;
    --accent-2: #6b3fa0;
    --accent-soft: #ece9f5;
    --paper: #f7f6fa;
    --paper-2: #f1eefa;
    --header-bg-1: #121218;
    --header-bg-2: #2a2a35;
}

/* Registering the angle as a proper animatable type lets the browser
   smoothly tween between arbitrary angles (not just interpolate two
   keyframes) -- browsers without @property support just see a static
   gradient at the initial-value angle, which is a fine fallback. */
@property --grad-angle {
    syntax: '<angle>';
    inherits: true;
    initial-value: 135deg;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
}

/* Very faint, slowly-drifting two-tone wash behind the whole page --
   a little ambient life without affecting any card/content readability
   (cards are all opaque white, see .card/.polish-card/etc.). The angle
   wanders through an irregular sequence of values rather than a simple
   back-and-forth sweep, so it doesn't read as a mechanical loop -- think
   a slow, ambient visualizer rather than a spinning dial. */
body {
    min-height: 100vh;
    background-image: linear-gradient(var(--grad-angle), var(--paper) 0%, var(--paper-2) 100%);
    animation: paper-drift 150s ease-in-out infinite;
}
@keyframes paper-drift {
    0%   { --grad-angle: 135deg; }
    17%  { --grad-angle: 40deg; }
    33%  { --grad-angle: 210deg; }
    52%  { --grad-angle: 300deg; }
    68%  { --grad-angle: 95deg; }
    84%  { --grad-angle: 250deg; }
    100% { --grad-angle: 135deg; }
}
@media (prefers-reduced-motion: reduce) {
    body { animation: none; }
}

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

.wrap {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header -- gradient "polish sheen" + a soft drifting sparkle layer. Body
   content below stays flat/white so the glitter reads as an accent, not
   the whole page. */
.site-header {
    position: relative;
    overflow: hidden;
    background: linear-gradient(120deg, var(--header-bg-1) 0%, var(--header-bg-2) 100%);
}
.site-header::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.55;
    mix-blend-mode: screen;
    background-image:
        radial-gradient(circle at 8% 22%, #fff 0, #fff 1px, transparent 1.6px),
        radial-gradient(circle at 24% 68%, #fff 0, #fff 1.2px, transparent 1.8px),
        radial-gradient(circle at 42% 15%, #fff 0, #fff 1px, transparent 1.5px),
        radial-gradient(circle at 58% 55%, #fff 0, #fff 1.4px, transparent 2px),
        radial-gradient(circle at 73% 30%, #fff 0, #fff 1px, transparent 1.5px),
        radial-gradient(circle at 88% 72%, #fff 0, #fff 1.2px, transparent 1.8px),
        radial-gradient(circle at 95% 12%, #fff 0, #fff 1px, transparent 1.5px),
        radial-gradient(circle at 12% 88%, #fff 0, #fff 1.1px, transparent 1.7px);
    background-repeat: repeat;
    background-size: 220px 140px;
    animation: sparkle-drift 24s linear infinite;
}
@keyframes sparkle-drift {
    from { background-position: 0 0; }
    to { background-position: 220px 140px; }
}
@media (prefers-reduced-motion: reduce) {
    .site-header::after { animation: none; }
}

.site-header__inner {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 20px;
    min-height: 64px;
    padding: 10px 0;
    flex-wrap: wrap;
}
.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--header-ink);
    letter-spacing: -0.02em;
}
.logo span { color: rgba(255, 255, 255, 0.75); }
.site-search { flex: 1; max-width: 420px; }
.site-search input {
    width: 100%;
    padding: 9px 14px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--ink);
    font-size: 0.9rem;
}
.site-search input::placeholder { color: var(--ink-soft); }
.site-nav {
    display: flex;
    align-items: center;
    gap: 18px;
    font-size: 0.92rem;
    white-space: nowrap;
}
.site-nav a, .site-nav .link-button {
    color: var(--header-ink-soft);
    padding: 9px 14px;
    border-radius: 8px;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.site-nav a:hover, .site-nav .link-button:hover {
    color: var(--header-ink);
    text-decoration: none;
    background: rgba(255, 255, 255, 0.14);
}
.site-nav a:active, .site-nav .link-button:active {
    background: rgba(255, 255, 255, 0.24);
}

.site-header .button-link {
    background: rgba(255, 255, 255, 0.95);
    color: var(--accent) !important;
    padding: 9px 18px;
}
.site-header .button-link:hover { background: #fff; }
.site-header .button-link:active { background: rgba(255, 255, 255, 0.85); }

/* Mobile nav toggle -- CSS-only checkbox hack, hidden above the mobile
   breakpoint. The checkbox is visually hidden but NOT display:none, so
   it stays keyboard-focusable/toggleable (Tab + Space); the label is a
   full 44x44 tap target (not just the thin icon graphic) so it's easy
   to hit on touch or in a narrow desktop window. */
.nav-toggle-checkbox {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
}
.nav-toggle-label {
    display: none;
    position: relative;
    width: 44px;
    height: 44px;
    margin-left: auto;
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.15s ease;
}
.nav-toggle-label:hover { background: rgba(255, 255, 255, 0.14); }
.nav-toggle-label:active { background: rgba(255, 255, 255, 0.24); }
.nav-toggle-checkbox:focus-visible ~ .nav-toggle-label {
    outline: 2px solid #fff;
    outline-offset: 2px;
}
.nav-toggle-label::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 2px;
    background: var(--header-ink);
    border-radius: 2px;
    transform: translate(-50%, -50%);
    box-shadow: 0 -7px 0 var(--header-ink), 0 7px 0 var(--header-ink);
}

.site-header__collapsible {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
    min-width: 0;
}

.button-link, button.primary, input[type=submit].primary {
    display: inline-block;
    background: var(--accent);
    color: var(--accent-ink) !important;
    padding: 10px 18px;
    border: none;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    min-height: 40px;
}
.button-link:hover, button.primary:hover { filter: brightness(0.92); text-decoration: none; }

.link-button {
    background: none;
    border: none;
    color: var(--ink-soft);
    font: inherit;
    cursor: pointer;
    padding: 4px 0;
}
.link-button:hover { color: var(--accent); text-decoration: underline; }
.inline-form { display: inline; }

/* Layout basics */
main.wrap { padding-top: 28px; padding-bottom: 60px; min-height: calc(100vh - 200px); }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 20px;
}

h1 { font-size: 1.6rem; margin: 0 0 12px; letter-spacing: -0.01em; }
h2 { font-size: 1.2rem; margin: 0 0 10px; }
p.subtle, .subtle { color: var(--ink-soft); font-size: 0.9rem; }

/* Forms */
form.stack { display: flex; flex-direction: column; gap: 14px; max-width: 420px; }
label { display: block; font-weight: 600; font-size: 0.85rem; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=search],
input[type=date], input[type=url], textarea, select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--paper);
    color: var(--ink);
    min-height: 42px;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, textarea:focus, select:focus {
    outline: 2px solid var(--violet);
    outline-offset: 1px;
}
.field-hint { font-size: 0.8rem; color: var(--ink-soft); margin-top: 4px; }
.required-mark { color: var(--accent); font-weight: 700; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row label { margin: 0; font-weight: 500; }
.checkbox-row input[type=checkbox] { width: 18px; height: 18px; }

/* Flash messages */
.flash {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 18px;
    font-size: 0.9rem;
}
.flash--success { background: var(--success-bg); color: var(--success); }
.flash--error { background: var(--error-bg); color: var(--error); }
.flash--info { background: var(--accent-soft); color: var(--accent); }

/* Profile header */
.profile-header {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}
.avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--accent-soft);
    border: 1px solid var(--line);
    flex-shrink: 0;
}
.avatar--sm { width: 40px; height: 40px; }
.profile-meta { min-width: 0; }
.profile-meta h1 { margin-bottom: 2px; word-break: break-word; }
.profile-stats { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 10px; font-size: 0.85rem; color: var(--ink-soft); }
.badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 9px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
}

/* Toolbar for browse/search/sort */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 18px;
}
.toolbar select, .toolbar input[type=search] { width: auto; }
.toolbar .spacer { flex: 1; }

/* Polish grid */
.polish-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(180px, 100%), 1fr));
    gap: 16px;
}
.polish-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
    display: block;
    color: inherit;
}
.polish-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); text-decoration: none; }
.polish-card__photo {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: var(--accent-soft);
    display: block;
}
.polish-card__body { padding: 10px 12px; }
.polish-card__name { font-weight: 600; font-size: 0.92rem; margin: 0 0 2px; }
.polish-card__maker { font-size: 0.8rem; color: var(--ink-soft); }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag-chip {
    font-size: 0.72rem;
    padding: 2px 9px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    white-space: nowrap;
}
.tag-chip--user { background: #ece7fb; color: var(--violet); }

/* Tables (admin) -- scroll horizontally on narrow screens instead of
   squeezing/breaking layout. */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 16px; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.data-table th, table.data-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data-table th { color: var(--ink-soft); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }

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

/* Feed items (/feed, /discover) */
.feed-item { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.feed-item__user { display: inline-flex; align-items: center; gap: 8px; color: inherit; font-weight: 600; font-size: 0.85rem; width: fit-content; }
.feed-item__user:hover { color: var(--accent); text-decoration: none; }
.feed-item__body { display: flex; align-items: center; gap: 12px; color: inherit; }
.feed-item__body:hover { text-decoration: none; }
.feed-item__body p { margin: 0; }
.feed-item__photo { width: 64px; height: 64px; border-radius: var(--radius); object-fit: cover; background: var(--accent-soft); flex-shrink: 0; }
#feed-tail { text-align: center; padding: 8px 0 20px; }

.site-footer {
    border-top: 1px solid var(--line);
    padding: 20px 0;
    color: var(--ink-soft);
    font-size: 0.82rem;
}
.site-footer__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.site-footer p.subtle { margin: 0; }

/* Theme picker -- true, hardcoded palette per swatch (independent of the
   currently active theme's CSS variables) so all options are visible at
   once. Keep in sync with lib/theme.php THEMES and the [data-theme-color]
   blocks above. */
.theme-picker { display: flex; align-items: center; gap: 8px; }
.theme-picker__label { font-weight: 600; color: var(--ink-soft); margin-right: 2px; }
.theme-swatch {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid transparent;
    padding: 0;
    cursor: pointer;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.theme-swatch.is-active { border-color: var(--ink); }
.theme-swatch--pink-classic { background: linear-gradient(135deg, #b3457a, #e0729e); }
.theme-swatch--purple-holo { background: linear-gradient(135deg, #7b2ff7, #d946ef); }
.theme-swatch--red-creme { background: linear-gradient(135deg, #c81d3f, #ff6b6b); }
.theme-swatch--rose-gold { background: linear-gradient(135deg, #b8763f, #d88a97); }
.theme-swatch--teal-duo { background: linear-gradient(135deg, #0f9b8e, #3a6cf6); }
.theme-swatch--black-multichrome { background: linear-gradient(135deg, #2a2a35, #6b3fa0); }

/* ---------------------------------------------------------------------
   Mobile
   --------------------------------------------------------------------- */
@media (max-width: 720px) {
    .wrap { padding: 0 16px; }

    .nav-toggle-label { display: block; }
    .site-header__inner { gap: 12px; }
    .site-header__collapsible {
        flex-basis: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.2s ease;
    }
    .nav-toggle-checkbox:checked ~ .site-header__collapsible {
        max-height: 400px;
        padding-bottom: 14px;
    }
    .site-search { max-width: none; }
    .site-nav {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .site-nav a, .site-nav .link-button {
        display: block;
        width: 100%;
        text-align: left;
        padding: 13px 16px;
        background: rgba(255, 255, 255, 0.1);
    }
    .site-nav .button-link { width: 100%; text-align: center; }

    h1 { font-size: 1.35rem; }

    .card { padding: 18px; }

    form.stack { max-width: none; }

    .toolbar { flex-direction: column; align-items: stretch; }
    .toolbar select, .toolbar input[type=search] { width: 100%; }
    .toolbar .spacer { display: none; }
    .toolbar button.primary { width: 100%; }

    .polish-grid { grid-template-columns: repeat(auto-fill, minmax(min(140px, 100%), 1fr)); gap: 12px; }

    .profile-header { text-align: center; justify-content: center; }
    .profile-meta { width: 100%; }
    .profile-stats { justify-content: center; }

    .site-footer__inner { flex-direction: column; align-items: flex-start; }

    button.primary, .button-link, .link-button, input[type=submit] {
        min-height: 44px;
    }
}
