/* ══════════════════════════════════════════════════════════════
   TAMBURINS - Design System
   Theme: Minimalist · Concrete · Clean Aesthetic
══════════════════════════════════════════════════════════════ */
:root {
  /* Colour - minimalist palette inspired by TAMBURINS */
  --c-bg:        #f9f9f9;
  --c-surface:   #ffffff;
  --c-surface-2: #f0f0f0;
  --c-border:    #e0e0e0;
  --c-border-focus: #111111;

  --c-brand-hi:  #888888;
  --c-brand:     #333333;
  --c-brand-lo:  #000000;
  --c-brand-warm:#555555;

  --c-text:      #111111;
  --c-text-soft: #666666;
  --c-text-muted:#999999;

  --c-ok:  #3a8c60;
  --c-err: #b03030;
  --c-info:#4a88b0;

  /* Type */
  --f-serif: 'Playfair Display', Georgia, serif;
  --f-sans:  'Inter', system-ui, -apple-system, sans-serif;

  /* Spacing */
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.25rem;
  --s-6: 1.5rem;
  --s-8: 2rem;
  --s-10: 2.5rem;
  --s-12: 3rem;

  /* Radii - TAMBURINS is more stark, use smaller radii */
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;
  --r-xl: 12px;
  --r-2xl: 16px;

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast: 150ms;
  --dur-base: 280ms;
  --dur-slow: 500ms;
}

/* ══════════════════════════════════════════════════════════════
   Reset
══════════════════════════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

/* ══════════════════════════════════════════════════════════════
   Base - stark minimal bg
══════════════════════════════════════════════════════════════ */
body {
  font-family: var(--f-sans);
  background: var(--c-bg);
  color: var(--c-text);
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-8) var(--s-4);
}

/* ══════════════════════════════════════════════════════════════
   Layout
══════════════════════════════════════════════════════════════ */
.layout {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: var(--s-6);
  animation: layoutFadeIn var(--dur-slow) var(--ease-out) both;
}

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

/* ══════════════════════════════════════════════════════════════
   Brand / Header
══════════════════════════════════════════════════════════════ */
.brand {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
}

.brand__eyebrow {
  font-family: var(--f-sans);
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--c-brand-warm);
  border: 1px solid var(--c-border);
  padding: var(--s-1) var(--s-4);
  border-radius: 999px;
  background: var(--c-surface);
}

.brand__name {
  font-family: var(--f-serif);
  font-style: normal;
  font-size: clamp(2rem, 8vw, 3rem);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: 0.02em;
  color: var(--c-brand-lo);
}

.brand__sub {
  font-family: var(--f-sans);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.45em;
  text-transform: uppercase;
  color: var(--c-brand);
  margin-top: calc(var(--s-1) * -1);
}

.brand__tagline {
  font-family: var(--f-serif);
  font-style: italic;
  font-size: 0.85rem;
  color: var(--c-text-soft);
  margin-top: var(--s-1);
}

/* ══════════════════════════════════════════════════════════════
   Card
══════════════════════════════════════════════════════════════ */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-2xl);
  padding: var(--s-8);
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.05);
}

/* ══════════════════════════════════════════════════════════════
   Output - three states
══════════════════════════════════════════════════════════════ */
.output {
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  min-height: 140px;
  padding: var(--s-6);
  position: relative;
  transition: border-color var(--dur-base) var(--ease-out),
              box-shadow var(--dur-base) var(--ease-out);
}

.output[data-state="result"] {
  border-color: var(--c-brand);
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.03);
}

/* Shared: centred helper for empty + loading states */
.output__empty,
.output__loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-3);
  color: var(--c-text-muted);
  font-size: 0.84rem;
  pointer-events: none;
  transition: opacity var(--dur-fast);
}

/* Flower icon for Tamburins */
.output__drop-icon {
  width: 28px;
  height: 28px;
  color: var(--c-brand-hi);
  opacity: 0.5;
  animation: pulse 3s ease-in-out infinite;
}
.output__drop-icon svg {
  width: 100%;
  height: 100%;
}

@keyframes pulse {
  0%, 100% { opacity: 0.35; transform: scale(1); }
  50%      { opacity: 0.6;  transform: scale(1.05); }
}

.output__empty strong {
  color: var(--c-text-soft);
  font-weight: 500;
}

/* Loading spinner */
.spinner {
  width: 22px;
  height: 22px;
  border: 2.5px solid var(--c-border);
  border-top-color: var(--c-brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Result text - selectable for manual long-press copy */
.output__text {
  font-size: 0.9375rem;
  line-height: 1.72;
  color: var(--c-text);
  word-break: break-word;
  -webkit-user-select: text;
  user-select: text;
  cursor: text;
}

/* State visibility (data-state attribute) */
.output[data-state="empty"] .output__empty  { opacity: 1; }
.output[data-state="empty"] .output__loading { opacity: 0; }
.output[data-state="empty"] .output__text   { visibility: hidden; }

.output[data-state="loading"] .output__empty  { opacity: 0; }
.output[data-state="loading"] .output__loading { opacity: 1; }
.output[data-state="loading"] .output__text   { visibility: hidden; }

.output[data-state="result"] .output__empty  { opacity: 0; pointer-events: none; }
.output[data-state="result"] .output__loading { opacity: 0; pointer-events: none; }

/* Result reveal animation */
@keyframes resultReveal {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.output[data-state="result"] .output__text {
  visibility: visible;
  animation: resultReveal var(--dur-base) var(--ease-out) both;
}

/* ══════════════════════════════════════════════════════════════
   Buttons
══════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: 0.75rem 1.5rem;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-family: var(--f-sans);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition:
    background var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast),
    transform var(--dur-fast) var(--ease-spring),
    box-shadow var(--dur-fast) var(--ease-out),
    opacity var(--dur-fast);
  white-space: nowrap;
  -webkit-user-select: none;
  user-select: none;
}

.btn:focus-visible {
  outline: 2px solid var(--c-brand);
  outline-offset: 3px;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primary - solid black */
.btn--primary {
  width: 100%;
  min-height: 48px;
  padding: 0.9375rem 1.5rem;
  font-size: 0.9375rem;
  background: var(--c-brand-lo);
  color: #ffffff;
  border-color: transparent;
  border-radius: var(--r-lg);
}

.btn--primary:hover:not(:disabled) {
  background: var(--c-brand);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}

/* Outline */
.btn--outline {
  background: transparent;
  border-color: var(--c-border);
  color: var(--c-text-soft);
}

.btn--outline:hover:not(:disabled) {
  border-color: var(--c-brand);
  color: var(--c-brand-lo);
  background: var(--c-surface-2);
}

/* Ghost */
.btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--c-text-soft);
}

.btn--ghost:hover:not(:disabled) {
  background: var(--c-surface-2);
  color: var(--c-text);
}

/* ══════════════════════════════════════════════════════════════
   Actions row
══════════════════════════════════════════════════════════════ */
.actions {
  display: flex;
}

.actions .btn--outline { flex: 1; min-height: 44px; }

.btn--outline.is-copied {
  border-color: var(--c-ok);
  color: var(--c-ok);
  background: #f0fdf4;
}

/* ══════════════════════════════════════════════════════════════
   Footer meta
══════════════════════════════════════════════════════════════ */
.meta {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--s-2);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c-text-muted);
}

/* ══════════════════════════════════════════════════════════════
   Toast notifications
══════════════════════════════════════════════════════════════ */
.toast-region {
  position: fixed;
  top: var(--s-5);
  right: var(--s-5);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--s-2);
  z-index: 100;
  pointer-events: none;
  max-width: min(340px, calc(100vw - 2 * var(--s-5)));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  width: 100%;
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  border: 1px solid var(--c-border);
  font-family: var(--f-sans);
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1.45;
  color: var(--c-text);
  background: var(--c-surface);
  pointer-events: auto;
  cursor: default;
  animation: toastSlideIn var(--dur-base) var(--ease-out) both;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.toast--ok  { border-left: 3px solid var(--c-ok); }
.toast--err { border-left: 3px solid var(--c-err); }
.toast--info { border-left: 3px solid var(--c-info); }

.toast__indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 0.3em;
}

.toast--ok   .toast__indicator { background: var(--c-ok); }
.toast--err  .toast__indicator { background: var(--c-err); }
.toast--info .toast__indicator { background: var(--c-info); }

.toast__msg { flex: 1; }

.toast.is-leaving {
  animation: toastSlideOut var(--dur-base) var(--ease-out) forwards;
}

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(12px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastSlideOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(12px); }
}

/* ══════════════════════════════════════════════════════════════
   Screen-reader only
══════════════════════════════════════════════════════════════ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ══════════════════════════════════════════════════════════════
   Responsive
══════════════════════════════════════════════════════════════ */
@media (max-width: 400px) {
  .card { padding: var(--s-6); }
  .brand__name { font-size: clamp(1.75rem, 10vw, 2.25rem); }
}
