/* giadaedemilio.com — design tokens + base element styles
 *
 * Source-of-truth for color, typography, spacing, motion. Shared by the
 * public site and the admin pages. Slice-specific layout lives alongside
 * the templates (home.css for landing, luna-di-miele.css for the map).
 *
 * Palette is the "kitsune" set per ADR-019: five named tokens plus
 * derived tints. Never invent new hex values — derive from these.
 */

@import url("https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;1,400;1,500&family=Source+Sans+3:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap");

:root {
  /* ---- Foundations: kitsune palette ----------------------------------- */
  --color-kitsune:      #D4652A;
  --color-gold:         #C4993C;
  --color-maple:        #B03A2E;
  --color-cream:        #F5F0E8;
  --color-ink:          #1A1612;

  --color-kitsune-soft: #E89A6B;
  --color-gold-soft:    #DDB877;
  --color-maple-soft:   #C8675E;
  --color-cream-warm:   #EFE6D7;
  --color-cream-deep:   #E8DBC4;
  --color-ink-soft:     #4A3E33;
  --color-ink-mute:     rgba(26, 22, 18, 0.55);
  --color-ink-faint:    rgba(26, 22, 18, 0.18);

  /* ---- Semantic tokens ------------------------------------------------ */
  --bg-page:        var(--color-cream);
  --bg-surface:     #FFFFFF;
  --bg-card:        var(--color-cream-warm);
  --bg-inverse:     var(--color-ink);

  --fg-primary:     var(--color-ink);
  --fg-secondary:   var(--color-ink-soft);
  --fg-muted:       var(--color-ink-mute);
  --fg-inverse:     var(--color-cream);

  --accent:         var(--color-kitsune);
  --accent-hover:   var(--color-maple);
  --accent-soft:    var(--color-kitsune-soft);
  --accent-quiet:   var(--color-gold);

  --border-quiet:   var(--color-cream-deep);
  --border-strong:  var(--color-gold);
  --border-accent:  var(--color-kitsune);

  --shadow-soft:    0 2px 12px rgba(26, 22, 18, 0.06);
  --shadow-card:    0 8px 28px rgba(26, 22, 18, 0.08);
  --shadow-popup:   0 14px 40px rgba(26, 22, 18, 0.18);
  --shadow-deep:    0 24px 60px rgba(26, 22, 18, 0.24);

  /* Legacy aliases — keep admin/rsvp templates compiling unchanged. */
  --color-gold-dim: var(--color-gold);
  --color-error:    var(--color-maple);
  --color-error-bg: rgba(176, 58, 46, 0.08);
  --color-success:  #187a3e;
  --color-warn:     #b46c00;
  --color-muted:    var(--color-ink-soft);
  --color-line:     var(--color-cream-deep);

  --shadow-sm: var(--shadow-soft);
  --shadow-md: var(--shadow-card);

  /* ---- Typography ----------------------------------------------------- */
  --font-display: "Cormorant Garamond", "EB Garamond", "Georgia", serif;
  --font-body:    "Source Sans 3", "Helvetica Neue", Arial, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, "SF Mono", Consolas, monospace;

  /* Legacy aliases */
  --font-text:    var(--font-body);

  --text-xs:   clamp(0.75rem,  0.7rem  + 0.25vw, 0.875rem);
  --text-sm:   clamp(0.875rem, 0.8rem  + 0.35vw, 1rem);
  --text-base: clamp(1rem,     0.9rem  + 0.5vw,  1.125rem);
  --text-lg:   clamp(1.25rem,  1.1rem  + 0.75vw, 1.5rem);
  --text-xl:   clamp(1.5rem,   1.2rem  + 1.5vw,  2.25rem);
  --text-2xl:  clamp(2rem,     1.5rem  + 2.5vw,  3.5rem);
  --text-3xl:  clamp(2.5rem,   1.8rem  + 3.5vw,  5rem);
  --text-4xl:  clamp(3rem,     2rem    + 5vw,    7rem);

  --leading-tight: 1.15;
  --leading-snug:  1.3;
  --leading-body:  1.6;
  --leading-loose: 1.8;

  --tracking-wide:    0.08em;
  --tracking-wider:   0.16em;
  --tracking-normal:  0;
  --tracking-tight:   -0.01em;

  /* ---- Spacing -------------------------------------------------------- */
  --space-xs:  0.25rem;
  --space-sm:  0.5rem;
  --space-md:  1rem;
  --space-lg:  2rem;
  --space-xl:  4rem;
  --space-2xl: 8rem;

  /* ---- Radii + motion ------------------------------------------------- */
  --radius-sm: 4px;
  --radius-md: 10px;
  --radius-lg: 18px;
  --radius-pill: 999px;

  --easing-standard: cubic-bezier(0.4, 0, 0.2, 1);
  --easing-soft:     cubic-bezier(0.22, 0.61, 0.36, 1);
  --easing-bounce:   cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast:   140ms;
  --duration-base:   240ms;
  --duration-slow:   500ms;
}

/* ---- Base elements --------------------------------------------------- */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-page);
  color: var(--fg-primary);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

main, .container, .page {
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-md);
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--fg-primary);
  margin: 0 0 var(--space-md);
  text-wrap: balance;
}
h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); margin-top: var(--space-lg); }
h3 { font-size: var(--text-xl); font-weight: 500; }
h4 { font-size: var(--text-lg); font-weight: 500; }

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color var(--duration-fast), color var(--duration-fast);
}
a:hover { color: var(--accent-hover); border-bottom-color: currentColor; }

p { margin: 0 0 var(--space-md); line-height: var(--leading-body); text-wrap: pretty; }
hr { border: 0; border-top: 1px solid var(--border-quiet); margin: var(--space-lg) 0; }

small, .text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.text-muted { color: var(--fg-muted); }
.text-secondary { color: var(--fg-secondary); }

code, kbd, pre { font-family: var(--font-mono); font-size: 0.92em; }

blockquote {
  border-left: 3px solid var(--accent-quiet);
  margin: var(--space-md) 0;
  padding: var(--space-sm) var(--space-md);
  background: rgba(196, 153, 60, .08);
  color: var(--fg-primary);
  font-style: italic;
}

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

form { margin: 0; }

label {
  display: block;
  margin: var(--space-sm) 0;
  font-size: .95rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="tel"],
select,
textarea {
  width: 100%;
  max-width: 28rem;
  padding: 8px 10px;
  border: 1px solid var(--border-quiet);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  font: inherit;
  color: inherit;
  transition: border-color .15s, box-shadow .15s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-quiet);
  box-shadow: 0 0 0 3px rgba(196, 153, 60, .25);
}

textarea { min-height: 6em; resize: vertical; }

button,
input[type="submit"],
.btn {
  appearance: none;
  font: inherit;
  padding: 8px 16px;
  border: 1px solid var(--color-ink);
  background: var(--color-ink);
  color: var(--color-cream);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s, transform .05s;
}

button:hover { background: var(--color-ink-soft); }
button:active { transform: translateY(1px); }

button.secondary,
button[type="button"] {
  background: transparent;
  color: var(--color-ink);
}
button.secondary:hover,
button[type="button"]:hover {
  background: rgba(26, 22, 18, .06);
}

button.danger,
button[style*="color:#b00020"] {
  background: transparent;
  border-color: var(--color-maple);
  color: var(--color-maple);
}
button.danger:hover { background: rgba(176, 58, 46, .08); }

fieldset {
  border: 1px solid var(--border-quiet);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin: var(--space-md) 0;
  background: var(--bg-surface);
}
legend {
  padding: 0 var(--space-sm);
  font-family: var(--font-display);
  color: var(--accent-quiet);
}

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

.row {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
  flex-wrap: wrap;
  margin: var(--space-sm) 0;
}

.actions form,
.actions a,
.actions button { display: inline-block; margin-right: var(--space-sm); }

.muted { color: var(--fg-muted); font-size: .9rem; }

/* --- Messages -------------------------------------------------------- */

.err {
  color: var(--color-maple);
  background: var(--color-error-bg);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  margin: var(--space-sm) 0;
}

.stato-inviato { color: var(--color-success); }
.stato-atteso  { color: var(--color-warn); }

/* --- Tables ---------------------------------------------------------- */

table {
  border-collapse: collapse;
  width: 100%;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

th, td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border-quiet);
}
th {
  background: rgba(196, 153, 60, .08);
  font-weight: 600;
  font-size: .9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-quiet);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(196, 153, 60, .04); }

/* --- Tags / badges --------------------------------------------------- */

.tag {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(26, 22, 18, .08);
  color: var(--color-ink);
  border-radius: 999px;
  font-size: .8rem;
  margin-right: 4px;
}

/* --- Admin nav ------------------------------------------------------- */

nav {
  display: flex;
  gap: var(--space-md);
  align-items: center;
  padding: var(--space-md) var(--space-lg);
  background: var(--color-ink);
  color: var(--color-cream);
}
nav a {
  color: var(--color-cream);
  border-bottom-color: transparent;
}
nav a:hover { border-bottom-color: var(--color-gold); }
nav form { margin-left: auto; }
nav button {
  background: transparent;
  border-color: var(--color-cream);
  color: var(--color-cream);
}
nav button:hover { background: rgba(255, 255, 255, .08); }

/* --- Stats / totali block ------------------------------------------- */

.totali {
  display: flex;
  gap: var(--space-lg);
  flex-wrap: wrap;
  background: var(--bg-surface);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  margin: var(--space-md) 0;
}
.totali strong {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--accent-quiet);
  display: block;
}

/* --- HTMX indicators ------------------------------------------------- */

.htmx-indicator {
  display: none;
  margin-left: var(--space-sm);
  color: var(--fg-muted);
  font-size: .85rem;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { display: inline; }

/* Card-style page sections */
.card {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  box-shadow: var(--shadow-soft);
  margin: var(--space-md) 0;
}
