/* ── Fonts ──────────────────────────── */
/*
 * Typeface: Karrik by Jean-Baptiste Morizot, Lucas Le Bihan.
 * Distributed by velvetyne.fr (https://velvetyne.fr/fonts/karrik/).
 * Licensed under the SIL Open Font License v1.1 — see /fonts/LICENCE.txt.
 */
@font-face {
  font-family: 'Karrik';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/Karrik-Regular.woff2') format('woff2');
}

@font-face {
  font-family: 'Karrik';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/Karrik-Italic.woff2') format('woff2');
}

:root {
  color-scheme: dark;
  --primary: #ffb786;
  --primary-container: #b84c00;
  --on-primary-container: #ffffff;
  --accent: #f57c00;
  --bg: oklch(0.1452 0.006 55);
  --surface: oklch(0.2393 0.009 55);
  --border: rgba(255, 255, 255, 0.08);
  --text: #e2e2e2;
  --text-dim: #a68b7c;
  --r: 16px;
  --r-sm: 8px;
  /* Type scale */
  --fs-caption: 12px;
  --fs-sm: 14px;
  --fs-base: 16px;
  --fs-md: 18px;
  --fs-lg: 22px;
  --fs-xl: 30px;
  --fs-display: clamp(40px, 6.5vw, 60px);
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

html {
  background: var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Karrik', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding:
    calc(24px + env(safe-area-inset-top)) calc(20px + env(safe-area-inset-right)) calc(32px + env(safe-area-inset-bottom)) calc(20px + env(safe-area-inset-left));
}

/* ── Brand header ───────────────────────────────────────────── */
.v-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 12px 0 30px;
}

.v-logo {
  height: 38px;
  width: auto;
  display: block;
}

.v-name {
  font-family: 'Karrik', sans-serif;
  font-size: var(--fs-xl);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text);
  text-align: center;
  overflow-wrap: anywhere;
}

.v-tagline {
  font-family: 'Karrik', sans-serif;
  font-size: var(--fs-caption);
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}

main {
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#links-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kc-notch {
  --notch: 16px;
  --kc-bw: 2px;
  --kc-border: var(--border);
  --kc-fill: var(--surface);
  position: relative;
  background: var(--kc-border);
  clip-path: polygon(0 0, calc(100% - var(--notch)) 0, 100% var(--notch), 100% 100%, 0 100%);
}

.kc-notch::before {
  content: '';
  position: absolute;
  inset: var(--kc-bw);
  background: var(--kc-fill);
  clip-path: polygon(0 0, calc(100% - var(--notch)) 0, 100% var(--notch), 100% 100%, 0 100%);
  pointer-events: none;
}

.kc-notch>* {
  position: relative;
  z-index: 1;
}

.notch-tr {
  clip-path: polygon(0 0, calc(100% - 13px) 0, 100% 13px, 100% 100%, 0 100%);
}

/* ── Link cards ──────────────────────────────────────────────────────────── */
@keyframes cardFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.link-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px 22px;
  min-height: 84px;
  text-decoration: none;
  color: inherit;
  transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1);
  opacity: 0;
  animation: cardFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.link-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--surface);
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 0 100%);
  z-index: 0;
}

.link-card>* {
  position: relative;
  z-index: 2;
}


.link-card .card-outline {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  overflow: visible;
  pointer-events: none;
}

.co-notch,
.co-draw {
  fill: none;
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-linejoin: round;
}

.co-notch {
  stroke-width: 2.5;
}

.co-draw {
  stroke-width: 2.5;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 420ms cubic-bezier(0.4, 0, 0.2, 1);
}

button.link-card {
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

a.link-card:hover,
a.link-card:focus-visible,
button.link-card:hover,
button.link-card:focus-visible {
  transform: translateY(-1px);
  outline: none;
}

a.link-card:hover .co-draw,
a.link-card:focus-visible .co-draw,
button.link-card:hover .co-draw,
button.link-card:focus-visible .co-draw {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 520ms cubic-bezier(0.16, 1, 0.3, 1);
}

a.link-card:active,
button.link-card:active {
  transform: translateY(1px) scale(0.992);
}

.card-content-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
}

.card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--primary);
  flex-shrink: 0;
}

.link-card.display-only .card-icon {
  color: var(--accent);
}

.card-icon svg {
  width: 24px;
  height: 24px;
}

.card-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.card-platform {
  font-family: 'Karrik', sans-serif;
  font-size: var(--fs-caption);
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-handle {
  font-family: 'Karrik', sans-serif;
  font-size: var(--fs-lg);
  font-weight: 400;
  line-height: 1.15;
  color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none; /* Firefox */
  -webkit-overflow-scrolling: touch;
}

.card-handle::-webkit-scrollbar { display: none; } /* WebKit/Blink */

/* ── Empty state ─────────────────────────────────────────────────────────── */
#empty-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-dim);
  font-family: 'Karrik', sans-serif;
  font-size: var(--fs-base);
}

/* ── CTA ─────────────────────────────────────────────────────────────────── */
.v-cta {
  margin-top: auto;
  padding-top: 16px;
}

.cta-divider {
  border: none;
  border-top: 1px dashed var(--border);
  margin: 32px 0 24px;
  opacity: 0.5;
}

.cta-eyebrow {
  margin: 0 0 14px;
  font-size: var(--fs-caption);
  font-weight: 400;
  letter-spacing: 0.02em;
  text-align: center;
  color: var(--text-dim);
}

#cta-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25em;
  width: 100%;
  height: 60px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--primary);
  --notch: 14px;
  clip-path: polygon(0 0, calc(100% - var(--notch)) 0, 100% var(--notch), 100% 100%, 0 100%);
  font-family: 'Karrik', sans-serif;
  font-size: var(--fs-md);
  font-weight: 400;
  text-decoration: none;
  transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1), filter 200ms, background 200ms, color 200ms, border-color 200ms;
}

#cta-btn:hover {
  background: var(--primary);
  color: #0c0a08;
  transform: translateY(-2px);
}
#cta-btn:active {
  transform: translateY(0);
}
#cta-btn:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}

.v-disclaimer {
  margin: 20px 0 0;
  font-size: var(--fs-caption);
  line-height: 1.5;
  text-align: center;
  color: var(--text-dim);
  opacity: 0.65;
}

.v-disclaimer a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 200ms;
}

.v-disclaimer a:hover {
  color: var(--text);
}

.cta-logo {
  height: 20px;
  width: auto;
  margin-left: 0.02em;
  transform: translateY(-2.2px);
  transition: filter 200ms;
}

#cta-btn:hover .cta-logo {
  filter: brightness(0);
}

/* ── Add to contacts (inside the save sheet) ─────────────────────────────── */
.v-vcard {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 50px;
  background: var(--primary);
  color: #0c0a08;
  border: none;
  border-radius: var(--r-sm);
  font-family: 'Karrik', sans-serif;
  font-size: var(--fs-base);
  font-weight: 400;
  cursor: pointer;
  transition: filter 150ms;
}

.v-vcard:hover { filter: brightness(1.06); }
.v-vcard:active { filter: brightness(0.95); }
.v-vcard:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.v-vcard:disabled { opacity: 0.6; cursor: default; }

.vcard-hint {
  margin-top: 8px;
  font-size: var(--fs-caption);
  text-align: center;
  color: var(--text-dim);
}

.save-sep {
  border: none;
  border-top: 1px dashed var(--border);
  margin: 18px 0 16px;
  opacity: 0.6;
}

/* ── External-link warning dialog ────────────────────────────────────────── */
#warn-overlay,
#copy-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.72);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

#warn-overlay[hidden],
#copy-overlay[hidden] {
  display: none;
}

#warn-dialog,
#copy-dialog {
  --kc-border: var(--primary);
  --kc-fill: #141414;
  --notch: 22px;
  width: 100%;
  max-width: 420px;
  padding: 28px 26px 22px;
}

#copy-go[hidden] {
  display: none;
}

.warn-title {
  font-family: 'Karrik', sans-serif;
  font-size: var(--fs-lg);
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 10px;
}

.warn-desc {
  font-size: var(--fs-sm);
  line-height: 1.55;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.warn-url {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  margin-bottom: 22px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}

.warn-host {
  font-family: 'Karrik', sans-serif;
  font-size: var(--fs-base);
  font-weight: 400;
  color: var(--text);
  word-break: break-all;
}

.warn-full {
  font-family: var(--mono);
  font-size: var(--fs-caption);
  line-height: 1.5;
  color: var(--text-dim);
  white-space: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  padding-bottom: 2px;
}

.warn-idn {
  display: flex;
  gap: 8px;
  margin-bottom: 22px;
  padding: 12px 14px;
  font-size: var(--fs-caption);
  line-height: 1.5;
  color: var(--text);
  background: rgba(245, 124, 0, 0.12);
  border: 1px solid var(--accent);
  border-radius: var(--r-sm);
}

.warn-idn[hidden] { display: none; }

.warn-actions {
  display: flex;
  gap: 10px;
}

.warn-btn {
  flex: 1;
  height: 54px;
  font-family: 'Karrik', sans-serif;
  font-size: var(--fs-base);
  font-weight: 400;
  cursor: pointer;
  border-radius: var(--r-sm);
  transition: filter 150ms, background 150ms;
}

.warn-cancel {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: none;
}

.warn-cancel:hover {
  background: rgba(255, 255, 255, 0.12);
}

.warn-go {
  background: var(--primary-container);
  color: var(--on-primary-container);
  border: none;
  font-weight: 400;
}

.warn-go:hover {
  filter: brightness(1.08);
}

.warn-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.warn-go:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 3px var(--bg);
}


/* ── Header nav buttons (back / save) ──────────────────────────────────────── */
.v-header {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.v-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.v-nav-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  height: 40px;
  padding: 0 12px;
  font-family: 'Karrik', sans-serif;
  font-size: var(--fs-sm);
  font-weight: 400;
  color: var(--text);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.06);
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 150ms, filter 150ms;
}

.v-nav-btn:hover { background: rgba(255, 255, 255, 0.1); }

.v-nav-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.v-back span {
  font-size: 26px;
  line-height: 1;
  margin-top: -4px;
}

.v-save.is-saved {
  background: var(--primary);
  border-color: var(--primary);
  color: #0c0a08;
  font-weight: 400;
}

.v-nav-spacer {
  background: none;
  border: none;
  cursor: default;
  pointer-events: none;
}

.v-nav-btn[hidden] { display: none; }


#save-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.72);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

#save-overlay[hidden] { display: none; }

#save-dialog {
  --kc-border: var(--primary);
  --kc-fill: #141414;
  --notch: 22px;
  width: 100%;
  max-width: 420px;
  padding: 28px 26px 22px;
}

.save-note {
  width: 100%;
  height: 50px;
  padding: 0 14px;
  margin-bottom: 12px;
  font-family: 'Karrik', sans-serif;
  font-size: var(--fs-base);
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}

.save-note:focus-visible {
  outline: none;
  border-color: var(--primary);
}

.save-hint {
  font-size: var(--fs-caption);
  line-height: 1.5;
  color: var(--text-dim);
  margin-bottom: 20px;
}

.save-remove {
  flex: 0 0 auto;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  border: none;
}

.save-remove:hover {
  color: #ff6b6b;
  background: rgba(255, 107, 107, 0.12);
}

.save-remove[hidden] { display: none; }


.saved-title {
  font-family: 'Karrik', sans-serif;
  font-size: var(--fs-lg);
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 4px;
}

.saved-empty {
  font-size: var(--fs-sm);
  line-height: 1.6;
  color: var(--text-dim);
  padding: 24px 4px;
}

.saved-empty strong { color: var(--text); }

.saved-icon {
  width: auto;
  min-width: 40px;
}

.saved-wordmark {
  height: 20px;
  width: auto;
  display: block;
}

.card-handle.untitled {
  color: var(--text-dim);
  font-style: italic;
  font-weight: 400;
}

.saved-tools {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.saved-tool {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.saved-tool-label {
  font-family: 'Karrik', sans-serif;
  font-size: var(--fs-base);
  font-weight: 400;
  color: var(--text);
}

.saved-tool-desc,
.saved-note {
  font-size: var(--fs-caption);
  line-height: 1.55;
  color: var(--text-dim);
}

.saved-tool-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.saved-tool-row input,
.saved-code {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: var(--fs-caption);
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  resize: vertical;
}

.saved-tool-row input { font-family: 'Karrik', sans-serif; font-size: var(--fs-sm); }

.saved-tool-row input:focus-visible,
.saved-code:focus-visible {
  outline: none;
  border-color: var(--primary);
}

.saved-btn {
  flex: 0 0 auto;
  padding: 0 18px;
  height: 46px;
  font-family: 'Karrik', sans-serif;
  font-size: var(--fs-sm);
  font-weight: 400;
  color: var(--on-primary-container);
  background: var(--primary-container);
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: filter 150ms, background 150ms;
}

.saved-btn:hover { filter: brightness(1.08); }

.saved-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.saved-btn-ghost {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: none;
}

.saved-btn-ghost:hover {
  background: rgba(255, 255, 255, 0.12);
  filter: none;
}

.saved-backup {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.saved-backup[hidden] { display: none; }

.saved-backup .saved-code { width: 100%; }

.saved-tool-msg {
  font-size: var(--fs-caption);
  line-height: 1.5;
  color: var(--primary);
}

.saved-tool-msg.is-error { color: #ff6b6b; }

.saved-tool-msg[hidden] { display: none; }

/* ── Saved card row + remove button ──────────────────────────────────────────*/
.saved-row {
  position: relative;
}

.saved-card .card-info {
  padding-right: 40px;
}

.saved-remove-btn {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  z-index: 5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  color: var(--text-dim);
  background: none;
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 150ms, color 150ms, background 150ms;
}

.saved-remove-btn:hover,
.saved-remove-btn:focus-visible {
  opacity: 1;
  color: #ff6b6b;
  background: rgba(255, 107, 107, 0.12);
  outline: none;
}

.saved-remove-btn:focus-visible {
  outline: 2px solid #ff6b6b;
  outline-offset: 2px;
}

/* ── Remove-confirmation dialog ──────────────────────────────────────────────*/
#confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.72);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

#confirm-overlay[hidden] { display: none; }

#confirm-dialog {
  --kc-border: var(--primary);
  --kc-fill: #141414;
  --notch: 22px;
  width: 100%;
  max-width: 420px;
  padding: 28px 26px 22px;
}