/* =========================================================
   2say.link - short speakable links, design system;
   deep-ink typography, one violet accent, soft surfaces,
   generous radii, no gradients, no decoration for its own sake.
   Plain CSS, no framework. Safe to edit by hand.
   ========================================================= */

/* ---------- 1. Tokens ---------- */
:root {
  /* Brand */
  --c-accent:        #6d4aff;
  --c-accent-hover:  #5b37f0;
  --c-accent-active: #4c2ada;
  --c-accent-soft:   #efeaff;
  --c-accent-ring:   rgba(109, 74, 255, 0.28);

  /* Ink */
  --c-ink:        #16141f;
  --c-ink-muted:  #55536b;
  --c-ink-faint:  #83819a;

  /* Surfaces */
  --c-bg:          #f5f4fa;
  --c-surface:     #ffffff;
  --c-surface-alt: #faf9fd;
  --c-border:      #e3e1ee;
  --c-border-strong: #cfccdf;

  /* Status */
  --c-success:      #1c9c6b;
  --c-success-soft: #e6f6ef;
  --c-warning:      #9a6a00;
  --c-warning-soft: #fdf3dc;
  --c-danger:       #d0342c;
  --c-danger-soft:  #fdeceb;

  /* Type */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
               Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --fs-h1:    clamp(1.9rem, 1.2rem + 2.4vw, 3rem);
  --fs-lead:  clamp(1.05rem, 0.98rem + 0.4vw, 1.25rem);
  --fs-base:  1rem;
  --fs-sm:    0.875rem;
  --fs-xs:    0.78rem;

  /* Space */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 2.75rem;

  /* Shape */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-pill: 999px;

  --shadow-card: 0 1px 2px rgba(22, 20, 31, 0.04),
                 0 8px 24px rgba(22, 20, 31, 0.06);
  --shadow-pop:  0 2px 4px rgba(22, 20, 31, 0.05),
                 0 12px 32px rgba(22, 20, 31, 0.10);
}

dialog {
  z-index: 10;
  text-align: center;
  border-color: var(--c-accent);
  box-shadow: 0 0 20px 30px var(--c-accent-soft);
  /*box-shadow: 0 0 20px 200px var(--c-border-strong);*/
  border-radius: var(--r-md);
  padding: 20px 20px;
  margin-top: 1%;
  font-family: var(--font-sans);
  font-size: var(--fs-lead);
  line-height: 1.5;
  color: var(--c-ink);
}


/* ---------- 2. Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.5;
  color: var(--c-ink);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  text-wrap: pretty;
}

h1, h2, h3, p { margin: 0; }

a {
  color: var(--c-accent);
  text-decoration: none;
  border-radius: 4px;
}
a:hover { color: var(--c-accent-hover); text-decoration: underline; }
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
}

/* ---------- 3. Page shell ---------- */
.page {
  flex: 1;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: var(--sp-6) var(--sp-5) var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-6);
}

.masthead { display: flex; flex-direction: column; gap: var(--sp-2); }

.masthead__title {
  font-size: var(--fs-h1);
  line-height: 1.08;
  letter-spacing: -0.025em;
  font-weight: 700;
}

.masthead__domain {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--c-ink-faint);
  letter-spacing: 0.02em;
}

/* Two columns on desktop, stacked on mobile. The masthead lives inside
   .left-col (not above the grid) so its top lines up with the form card's. */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 460px);
  gap: var(--sp-5);
  align-items: start;
}

.left-col { display: flex; flex-direction: column; gap: var(--sp-6); }

/* ---------- 4. Cards ---------- */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-card);
}

.card--quiet {
  background: var(--c-surface-alt);
  box-shadow: none;
}

/* Dynamic HTMX zone: subtitle + examples, replaced by cards/messages */
#dynamic-zone { display: flex; flex-direction: column; gap: var(--sp-4); }

.lead {
  font-size: var(--fs-lead);
  line-height: 1.4;
  color: var(--c-ink-muted);
  max-width: 34ch;
  margin-top: -20px;
}
.lead strong { color: var(--c-ink); font-weight: 600; }

/* ---------- 5. Examples ---------- */
.examples { display: flex; flex-direction: column; gap: var(--sp-3); margin-top: 20px; }

.examples__label {
  font-size: var(--fs-sm);
  color: var(--c-ink-muted);
  text-align: center;
}

.examples__list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.example-link {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--c-accent);
  background: var(--c-accent-soft);
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.example-link:hover {
  text-decoration: none;
  background: #e6dfff;
  border-color: var(--c-accent-ring);
}

/* ---------- 6. Form ---------- */
.form { display: flex; flex-direction: column; gap: var(--sp-4); }

.field { display: flex; flex-direction: column; gap: var(--sp-2); }

.label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--c-ink);
}

.input {
  width: 100%;
  padding: 0.7rem 0.85rem;
  font: inherit;
  color: var(--c-ink);
  background: var(--c-surface);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-md);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input::placeholder { color: var(--c-ink-faint); }
.input:hover { border-color: #b9b5cd; }
.input:focus {
  outline: none;
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px var(--c-accent-ring);
}
.input[aria-invalid="true"] { border-color: var(--c-danger); }

.hint {
  font-size: var(--fs-xs);
  color: var(--c-ink-faint);
  line-height: 1.45;
}

.field__error {
  font-size: var(--fs-xs);
  color: var(--c-danger);
  line-height: 1.45;
}

/* Checkbox */
.checkbox {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  cursor: pointer;
  font-size: var(--fs-sm);
  color: var(--c-ink-muted);
}
.checkbox input {
  appearance: none;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  border: 1px solid var(--c-border-strong);
  border-radius: 6px;
  background: var(--c-surface);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.checkbox input:checked {
  background: var(--c-accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8.5l3.2 3.2L13 5'/%3E%3C/svg%3E") center/13px no-repeat;
  border-color: var(--c-accent);
}
.checkbox input:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 0.72rem 1.4rem;
  font: inherit;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn--primary { background: var(--c-accent); color: #fff; }
.btn--primary:hover { background: var(--c-accent-hover); }
.btn--primary:active { background: var(--c-accent-active); }
.btn--ghost {
  background: transparent;
  color: var(--c-accent);
  border-color: var(--c-border-strong);
}
.btn--ghost:hover { background: var(--c-accent-soft); border-color: var(--c-accent-ring); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn--block { width: 100%; }

.form__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

/* HTMX request state */
.htmx-request .btn--primary { opacity: 0.7; pointer-events: none; }

/* ---------- 7. Result card (short link) ---------- */
.result { display: flex; flex-direction: column; gap: var(--sp-4); }

.result__eyebrow {
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-success);
}
.result__eyebrow--danger { color: var(--c-danger); }

.result__code {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--sp-2);
  font-family: var(--font-mono);
  font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.25rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--c-ink);
  word-break: break-all;
}
.result__code .num { color: var(--c-accent); }

/* copy-to-clipboard icon sitting next to the code */
.copy {
  position: relative;
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  background: var(--c-surface);
  color: var(--c-ink-faint);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}
.copy:hover {
  color: var(--c-accent);
  border-color: var(--c-accent);
  background: var(--c-accent-soft);
}
.copy.is-copied {
  color: var(--c-success);
  border-color: var(--c-success);
  background: var(--c-success-soft);
}

.copy__icon {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
}

/* the "Copied" bubble above the button, shown only right after a click */
.copy__flash {
  position: absolute;
  left: 50%;
  bottom: calc(100% + var(--sp-2));
  transform: translateX(-50%);
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--r-sm);
  background: var(--c-ink);
  color: var(--c-surface);
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.copy.is-copied .copy__flash { opacity: 1; }

.result__meta {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--c-border);
}
.result__meta dt {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-ink-faint);
}
.result__meta dd {
  margin: 0 0 var(--sp-3);
  font-size: var(--fs-sm);
  color: var(--c-ink);
  word-break: break-word;
}
.result__meta dd:last-child { margin-bottom: 0; }

/* ---------- 8. Messages ---------- */
.msg {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  line-height: 1.45;
  border: 1px solid transparent;
}
.msg__body { display: flex; flex-direction: column; gap: var(--sp-2); }
.msg__title { font-weight: 600; font-size: var(--fs-base); }
.msg--info    { background: var(--c-accent-soft);  border-color: var(--c-accent-ring); color: var(--c-ink); }
.msg--success { background: var(--c-success-soft);  border-color: #bfe6d5; color: var(--c-ink); }
.msg--warning { background: var(--c-warning-soft);  border-color: #f0dcae; color: var(--c-ink); }
.msg--error   { background: var(--c-danger-soft);   border-color: #f5c9c6; color: var(--c-ink); }

/* Verification code field injected into the form */
.verify {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-4);
  background: var(--c-accent-soft);
  border: 1px solid var(--c-accent-ring);
  border-radius: var(--r-md);
}
.verify .input {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  letter-spacing: 0.35em;
  text-align: center;
}

/* ---------- 9. Footer ---------- */
.footer {
  border-top: 1px solid var(--c-border);
  background: var(--c-surface-alt);
}
.footer__inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: var(--sp-4) var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  font-size: var(--fs-xs);
  color: var(--c-ink-faint);
}
.footer a { color: var(--c-ink-muted); }
.footer a:hover { color: var(--c-accent); }

/* ---------- 10. Public link card page / 404 ---------- */
.standalone {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6) var(--sp-5);
}
.standalone .card { width: 100%; max-width: 560px; }

/* ---------- 11. Utilities ---------- */
.stack-2 { display: flex; flex-direction: column; gap: var(--sp-2); }
.stack-3 { display: flex; flex-direction: column; gap: var(--sp-3); }
.muted { color: var(--c-ink-muted); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- 12. Responsive ---------- */
@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: var(--sp-4); }
  .left-col { gap: var(--sp-4); }
  .page { padding: var(--sp-5) var(--sp-4) var(--sp-4); gap: var(--sp-5); }
  .lead { max-width: none; margin-top: -4px; }
  .card { padding: var(--sp-4); border-radius: var(--r-md); }
  .form__actions .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
