/* ============================================
   CLAY ENCOUNTERS × HASHONE PROPOSAL
   Base Styles & Design Tokens
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400;1,600&family=DM+Sans:wght@300;400;500&family=DM+Serif+Display:ital@0;1&display=swap');

/* ---- PALETTE THEMES ---- */
:root {
  /* RAW CLAY (default) */
  --bg-primary:     #F2EBE0;
  --bg-secondary:   #E8DDD0;
  --bg-deep:        #D4C4B0;
  --surface:        #FAF6F0;
  --surface-raised: #FFFFFF;
  --text-primary:   #2C1F14;
  --text-secondary: #6B5040;
  --text-muted:     #9C8070;
  --accent:         #C4622D;
  --accent-warm:    #E8935A;
  --accent-deep:    #8B3A1A;
  --kiln:           #D4822A;
  --border:         rgba(100,70,50,0.15);
  --shadow:         rgba(44,31,20,0.12);
  --grain-opacity:  0.04;
  --highlight:      #F5C98A;

  /* Typography */
  --font-display:   'DM Serif Display', 'Playfair Display', Georgia, serif;
  --font-body:      'DM Sans', system-ui, sans-serif;

  /* Spacing */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  32px;
  --space-xl:  64px;
  --space-2xl: 96px;

  /* Radii */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --radius-xl: 32px;

  /* Transitions */
  --transition-fast:   0.15s ease;
  --transition-base:   0.3s ease;
  --transition-slow:   0.6s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* GLAZED TEAL theme */
[data-theme="teal"] {
  --bg-primary:     #0D2B2B;
  --bg-secondary:   #0A2020;
  --bg-deep:        #061515;
  --surface:        #123333;
  --surface-raised: #1A4040;
  --text-primary:   #E8F5F2;
  --text-secondary: #A0C8C0;
  --text-muted:     #607870;
  --accent:         #4ECDC4;
  --accent-warm:    #7EDDD6;
  --accent-deep:    #2A8C85;
  --kiln:           #D4AF37;
  --border:         rgba(78,205,196,0.15);
  --shadow:         rgba(0,0,0,0.4);
  --grain-opacity:  0.03;
  --highlight:      #D4AF37;
}

/* MIDNIGHT KILN theme */
[data-theme="midnight"] {
  --bg-primary:     #0F0A06;
  --bg-secondary:   #1A1008;
  --bg-deep:        #0A0603;
  --surface:        #1F1510;
  --surface-raised: #2A1E16;
  --text-primary:   #F0E8DC;
  --text-secondary: #C0A080;
  --text-muted:     #806050;
  --accent:         #FF6B2B;
  --accent-warm:    #FF9A5C;
  --accent-deep:    #CC4400;
  --kiln:           #FF8C42;
  --border:         rgba(255,107,43,0.15);
  --shadow:         rgba(0,0,0,0.6);
  --grain-opacity:  0.05;
  --highlight:      #FFD580;
}

/* PEARL WHITE theme */
[data-theme="pearl"] {
  --bg-primary:     #FAFAF8;
  --bg-secondary:   #F5F3EE;
  --bg-deep:        #EAE8E0;
  --surface:        #FFFFFF;
  --surface-raised: #FFFFFF;
  --text-primary:   #1A1A1A;
  --text-secondary: #5A5A5A;
  --text-muted:     #9A9A9A;
  --accent:         #8B6F5C;
  --accent-warm:    #B8967E;
  --accent-deep:    #5C3D2E;
  --kiln:           #C4A882;
  --border:         rgba(0,0,0,0.08);
  --shadow:         rgba(0,0,0,0.06);
  --grain-opacity:  0.02;
  --highlight:      #F0E0C0;
}

/* ---- RESET & BASE ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.6;
  transition: background-color var(--transition-slow),
              color var(--transition-slow);
}

/* ---- GRAIN TEXTURE OVERLAY ---- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
}

/* ---- TYPOGRAPHY ---- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.2;
  color: var(--text-primary);
}

h1 { font-size: clamp(2.5rem, 6vw, 5rem); font-weight: 400; }
h2 { font-size: clamp(1.8rem, 4vw, 3rem); font-weight: 400; }
h3 { font-size: clamp(1.3rem, 2.5vw, 1.8rem); font-weight: 400; }
h4 { font-size: 1.1rem; font-weight: 600; font-family: var(--font-body); letter-spacing: 0.05em; text-transform: uppercase; }

p {
  font-family: var(--font-body);
  font-weight: 300;
  color: var(--text-secondary);
  max-width: 65ch;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--accent-warm); }

/* ---- SHARED COMPONENTS ---- */

/* Room wrapper */
.room {
  min-height: 100vh;
  padding: var(--space-2xl) var(--space-xl);
  position: relative;
  overflow: hidden;
}

/* Section label */
.room-label {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.room-label::before {
  content: '';
  width: 24px;
  height: 1px;
  background: var(--accent);
}

/* Decorative divider */
.clay-divider {
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  margin: var(--space-lg) 0;
  opacity: 0.4;
}

/* Accent pill */
.pill {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 999px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
}

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  position: relative;
  transition: transform var(--transition-base),
              box-shadow var(--transition-base);
  box-shadow: 0 2px 20px var(--shadow);
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 40px var(--shadow);
}

/* ---- PALETTE SWITCHER ---- */
#palette-switcher {
  position: fixed;
  top: var(--space-md);
  right: var(--space-md);
  z-index: 1000;
}

.palette-trigger {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--text-secondary);
  box-shadow: 0 2px 12px var(--shadow);
  transition: all var(--transition-base);
  white-space: nowrap;
}
.palette-trigger:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}
.palette-trigger .pot-icon {
  font-size: 1rem;
  animation: potWobble 3s ease-in-out infinite;
}

@keyframes potWobble {
  0%, 100% { transform: rotate(-5deg); }
  50% { transform: rotate(5deg); }
}

.palette-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-sm);
  box-shadow: 0 8px 32px var(--shadow);
  display: none;
  min-width: 180px;
}
.palette-dropdown.open { display: block; }

.palette-option {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-secondary);
  transition: background var(--transition-fast);
}
.palette-option:hover { background: var(--bg-secondary); }
.palette-option.active { color: var(--accent); font-weight: 500; }

.palette-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ---- ROOM NAV ---- */
#room-nav {
  position: fixed;
  bottom: var(--space-lg);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 8px 16px;
  box-shadow: 0 4px 24px var(--shadow);
}

.nav-room {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: all var(--transition-base);
  white-space: nowrap;
}
.nav-room:hover,
.nav-room.active {
  background: var(--bg-deep);
  color: var(--text-primary);
}
.nav-room.active { color: var(--accent); }
.nav-room .nav-icon { font-size: 0.9rem; }

/* ---- ANIMATIONS ---- */
.fade-up {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity var(--transition-slow), transform var(--transition-slow);
}
.fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 3px; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .room { padding: var(--space-xl) var(--space-md); }
  #room-nav { display: none; }
}
