/* Ripple Loom — shared styles. Monochrome, minimal, premium. */
:root {
  --bg: #0a0a0b;
  --bg-soft: #141416;
  --bg-card: #161618;
  --bg-elev: #1c1c1f;
  --line: #2a2a2e;
  --line-soft: #202023;
  --fg: #f6f6f7;
  --fg-dim: #a1a1aa;
  --fg-faint: #6a6a72;
  --accent: #ffffff;
  --danger: #f04444;
  --danger-soft: #7f1d1d;
  --radius: 16px;
  --radius-lg: 22px;
  --radius-sm: 11px;
  --shadow: 0 20px 60px -12px rgba(0, 0, 0, 0.7);
  --shadow-soft: 0 8px 30px -8px rgba(0, 0, 0, 0.55);
  /* particle-ripple logo spheres (dark theme = light spheres) */
  --sphere-hi: #ffffff;
  --sphere-lo: #7c7c7c;
  --glow-a: rgba(255,255,255,0.05);
  --glow-b: rgba(255,255,255,0.025);
}

/* Light theme */
[data-theme="light"] {
  --bg: #f2f1ee;
  --bg-soft: #ecebe7;
  --bg-card: #ffffff;
  --bg-elev: #ffffff;
  --line: #dedcd6;
  --line-soft: #e8e6e1;
  --fg: #16161a;
  --fg-dim: #55555c;
  --fg-faint: #8c8c93;
  --sphere-hi: #4a4a4a;
  --sphere-lo: #050505;
  --glow-a: rgba(0,0,0,0.04);
  --glow-b: rgba(0,0,0,0.02);
  --shadow: 0 20px 60px -14px rgba(0, 0, 0, 0.16);
  --shadow-soft: 0 8px 30px -10px rgba(0, 0, 0, 0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body, .panel, .card, .btn, select.select, .input, .dock, .toggle-row, .glyph {
  transition: background-color .25s ease, color .25s ease, border-color .25s ease;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 300;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  background-image:
    radial-gradient(900px 500px at 50% -10%, var(--glow-a), transparent 60%),
    radial-gradient(600px 400px at 100% 100%, var(--glow-b), transparent 55%);
  background-attachment: fixed;
}

.serif { font-family: 'Instrument Serif', Georgia, serif; font-weight: 400; }
.italic { font-style: italic; }

a { color: inherit; text-decoration: none; }

/* Layout */
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 0; border-bottom: 1px solid var(--line-soft); margin-bottom: 40px;
}
.brand { display: flex; align-items: center; gap: 12px; font-size: 20px; letter-spacing: -0.01em; }
.brand-dot {
  width: 30px; height: 30px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.brand-dot svg { width: 100%; height: 100%; display: block; }
.brand b { font-weight: 500; }
.brand .serif { font-size: 24px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: inherit; font-size: 14px; font-weight: 400;
  padding: 11px 20px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--bg-soft); color: var(--fg); cursor: pointer;
  transition: all .18s ease; white-space: nowrap;
}
.btn:hover { border-color: var(--fg-faint); background: var(--bg-elev); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary {
  background: var(--fg); color: var(--bg); border-color: var(--fg); font-weight: 500;
  box-shadow: 0 0 24px rgba(127,127,127,0.16);
}
.btn-primary:hover { filter: brightness(0.92); background: var(--fg); border-color: var(--fg); color: var(--bg); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; border-color: #dc2626; }
.btn-ghost { background: transparent; }
.btn-lg { padding: 14px 28px; font-size: 15px; }
.btn-icon { padding: 10px; border-radius: 50%; width: 42px; height: 42px; justify-content: center; }

/* Cards / grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.card {
  background: var(--bg-card); border: 1px solid var(--line-soft); border-radius: var(--radius);
  overflow: hidden; transition: border-color .18s ease, transform .18s ease;
}
.card:hover { border-color: #333; transform: translateY(-2px); }
.card-thumb {
  aspect-ratio: 16/9; background: #000; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.card-thumb video, .card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.card-thumb .dur {
  position: absolute; bottom: 8px; right: 8px; background: rgba(0,0,0,.75);
  padding: 2px 8px; border-radius: 6px; font-size: 12px; font-variant-numeric: tabular-nums;
}
.card-body { padding: 14px 16px; }
.card-title { font-size: 15px; font-weight: 400; margin-bottom: 4px; }
.card-meta { font-size: 12.5px; color: var(--fg-faint); display: flex; gap: 10px; }
.card-actions { display: flex; gap: 8px; padding: 0 16px 14px; }

/* Empty state */
.empty { text-align: center; padding: 90px 20px; color: var(--fg-dim); }
.empty .serif { font-size: 34px; color: var(--fg); display: block; margin-bottom: 10px; }

/* Utility */
.row { display: flex; align-items: center; gap: 12px; }
.between { justify-content: space-between; }
.muted { color: var(--fg-dim); }
.faint { color: var(--fg-faint); }
.h1 { font-size: 30px; font-weight: 300; letter-spacing: -0.02em; }
.section-title { font-size: 14px; text-transform: uppercase; letter-spacing: .12em; color: var(--fg-faint); margin-bottom: 18px; }
.pill { font-size: 12px; padding: 4px 11px; border: 1px solid var(--line); border-radius: 999px; color: var(--fg-dim); }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }

/* Toast */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--fg); color: var(--bg); padding: 12px 22px; border-radius: 999px; font-size: 14px;
  font-weight: 500; opacity: 0; pointer-events: none; transition: all .25s ease; z-index: 999;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Premium components (recorder + shared) ---------- */

/* Elevated panel / glass card */
.panel {
  background: linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.01));
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); backdrop-filter: blur(12px);
}

/* Native select, restyled */
.field { display: flex; flex-direction: column; gap: 7px; }
.field-label {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--fg-faint); display: flex; align-items: center; gap: 7px;
}
.select-wrap { position: relative; }
.select-wrap::after {
  content: ''; position: absolute; right: 15px; top: 50%; width: 8px; height: 8px;
  border-right: 1.6px solid var(--fg-dim); border-bottom: 1.6px solid var(--fg-dim);
  transform: translateY(-65%) rotate(45deg); pointer-events: none;
}
select.select {
  -webkit-appearance: none; appearance: none; width: 100%;
  background: var(--bg-elev); color: var(--fg); font-family: inherit; font-size: 14.5px;
  font-weight: 400; padding: 13px 40px 13px 15px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease;
}
select.select:hover { border-color: #3a3a40; }
select.select:focus { outline: none; border-color: #4a4a52; box-shadow: 0 0 0 3px rgba(255,255,255,0.06); }
select.select option { background: var(--bg-elev); color: var(--fg); }

/* icon glyph in a soft rounded tile */
.glyph {
  width: 34px; height: 34px; flex: none; border-radius: 10px;
  background: var(--bg-elev); border: 1px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center; font-size: 16px;
}

/* Floating recorder control bar */
.dock {
  display: inline-flex; align-items: center; gap: 10px;
  background: rgba(20,20,22,0.82); border: 1px solid var(--line);
  border-radius: 999px; padding: 9px 12px; box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
}
.dock .divider { width: 1px; height: 24px; background: var(--line); }

/* Big record button */
.record-btn {
  display: inline-flex; align-items: center; gap: 10px; cursor: pointer;
  background: var(--danger); color: #fff; border: none; font-family: inherit;
  font-size: 15px; font-weight: 500; padding: 12px 22px; border-radius: 999px;
  box-shadow: 0 0 24px rgba(240,68,68,0.4); transition: transform .15s ease, box-shadow .15s ease;
}
.record-btn:hover { transform: scale(1.03); box-shadow: 0 0 34px rgba(240,68,68,0.55); }
.record-btn .ring {
  width: 15px; height: 15px; border-radius: 50%; border: 3px solid #fff;
}
.record-btn.stop .ring { border-radius: 4px; width: 13px; height: 13px; background: #fff; border: none; }

/* Segmented control (bubble position) */
.seg2 { display: inline-flex; background: var(--bg-elev); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg2 button {
  background: transparent; border: none; color: var(--fg-dim); cursor: pointer;
  font-family: inherit; font-size: 13px; width: 34px; height: 30px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center; transition: all .14s ease;
}
.seg2 button:hover { color: var(--fg); }
.seg2 button.on { background: var(--fg); color: #000; }

/* Recording status pill */
.rec-status { display: inline-flex; align-items: center; gap: 9px; padding: 0 6px 0 12px; }
.rec-status .timer { font-family: 'JetBrains Mono', monospace; font-size: 15px; font-variant-numeric: tabular-nums; }

/* Text input */
.input {
  background: var(--bg-elev); border: 1px solid var(--line); color: var(--fg);
  padding: 12px 14px; border-radius: var(--radius-sm); font-family: inherit; font-size: 14.5px;
  width: 100%; transition: border-color .15s ease;
}
.input:focus { outline: none; border-color: #4a4a52; }

/* Spinner + loading */
.spinner {
  width: 22px; height: 22px; flex: none; border: 2.5px solid var(--line);
  border-top-color: var(--fg); border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-wrap { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 90px 0; color: var(--fg-dim); font-size: 14px; }

/* Motion */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.card { animation: rise .4s ease both; }
.panel, #app { animation: fade .35s ease both; }

/* Inline rename */
.card-title { cursor: text; border-radius: 6px; transition: background .15s ease; }
.card-title[data-rename]:hover { background: rgba(255,255,255,0.05); box-shadow: 0 0 0 4px rgba(255,255,255,0.05); }
.title-edit {
  font-family: inherit; font-size: 15px; font-weight: 400; width: 100%;
  background: var(--bg-elev); border: 1px solid #4a4a52; color: var(--fg);
  border-radius: 7px; padding: 4px 8px; outline: none;
}
.rename-hint { font-size: 11px; color: var(--fg-faint); margin-top: 3px; }

/* ---------- Particle-ripple logo / theme toggle / footer ---------- */
.rl-logo-svg { width: 100%; height: 100%; overflow: visible; }

/* panel sits on the card color so it reads in light mode too */
.panel {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01)),
    var(--bg-card);
}

.site-footer {
  max-width: 1100px; margin: 64px auto 0; padding: 22px 24px 34px;
  border-top: 1px solid var(--line-soft);
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.footer-brand { font-size: 13px; color: var(--fg-dim); display: inline-flex; align-items: center; gap: 9px; }
.footer-brand b { color: var(--fg); font-weight: 500; }
.footer-brand:hover { color: var(--fg); }
.footer-mark { width: 20px; height: 20px; display: inline-flex; flex: none; }

.theme-toggle {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  background: var(--bg-elev); border: 1px solid var(--line); color: var(--fg-dim);
  border-radius: 999px; padding: 7px 14px; font-family: inherit; font-size: 12.5px;
  transition: all .18s ease;
}
.theme-toggle:hover { color: var(--fg); border-color: #3a3a40; }
.theme-toggle svg { width: 15px; height: 15px; }

/* light-mode fine-tuning */
[data-theme="light"] .btn-primary { box-shadow: 0 4px 18px rgba(0,0,0,0.14); }
[data-theme="light"] .g-btn { border: 1px solid var(--line); }
[data-theme="light"] .record-btn { box-shadow: 0 4px 18px rgba(240,68,68,0.3); }
[data-theme="light"] .theme-toggle:hover { border-color: #c3c1ba; }
