/* ═══════════════════════════════════════════════════
   ShortenURL — Apple Design System
   Reference: DESIGN.md (getdesign/apple)
   ═══════════════════════════════════════════════════ */

/* ── Font: Inter as SF Pro substitute ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&display=swap');

/* ── Design Tokens ── */
:root {
  /* Colors — Brand & Accent */
  --primary: #0066cc;
  --primary-focus: #0071e3;
  --primary-on-dark: #2997ff;

  /* Colors — Surface */
  --canvas: #ffffff;
  --canvas-parchment: #f5f5f7;
  --surface-tile-1: #272729;
  --surface-black: #000000;

  /* Colors — Text */
  --ink: #1d1d1f;
  --body-on-dark: #ffffff;
  --body-muted: #cccccc;
  --ink-muted-48: #7a7a7a;
  --on-primary: #ffffff;

  /* Colors — Hairlines */
  --hairline: #e0e0e0;
  --divider-soft: #f0f0f0;

  /* Colors — Feedback */
  --error: #ff3b30;

  /* Typography — Font Stacks */
  --font-display: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-text: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;

  /* Rounded */
  --rounded-sm: 8px;
  --rounded-md: 11px;
  --rounded-lg: 18px;
  --rounded-pill: 9999px;

  /* Spacing */
  --space-xxs: 4px;
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 17px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-xxl: 48px;
  --space-section: 80px;
}

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

/* ── Body ── */
body {
  font-family: var(--font-text);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.47;
  letter-spacing: -0.374px;
  color: var(--ink);
  background-color: var(--surface-black);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ═══════════════════════════════════════════════════
   Hero Section — Dark Tile
   ═══════════════════════════════════════════════════ */
.hero {
  background-color: var(--surface-tile-1);
  padding: var(--space-xl) var(--space-lg);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.hero-headline {
  font-family: var(--font-display);
  font-size: 56px;
  font-weight: 600;
  line-height: 1.07;
  letter-spacing: -0.29em;
  color: var(--body-on-dark);
  margin-bottom: var(--space-md);
  /* Adjusted for Inter: slightly tighter than SF Pro */
  letter-spacing: -0.28px;
}

.hero-tagline {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
  line-height: 1.14;
  letter-spacing: 0.196px;
  color: var(--body-muted);
  max-width: 600px;
}

/* ═══════════════════════════════════════════════════
   Main Content — Parchment Tile
   ═══════════════════════════════════════════════════ */
.main-section {
  background-color: var(--canvas-parchment);
  padding: var(--space-section) var(--space-lg);
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.card {
  background-color: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--rounded-lg);
  padding: var(--space-xl);
  width: 100%;
  max-width: 780px;
}

/* ── Section Title inside card ── */
.section-title {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  line-height: 1.19;
  letter-spacing: 0.231px;
  color: var(--ink);
  margin-bottom: var(--space-lg);
}

/* ── Card Content: Two Columns ── */
.card-content {
  display: flex;
  gap: var(--space-xl);
  align-items: stretch;
}

.left-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.right-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding-left: var(--space-xl);
  border-left: 1px solid var(--hairline);
  min-height: 220px;
}

/* ═══════════════════════════════════════════════════
   Input
   ═══════════════════════════════════════════════════ */
.input-group {
  margin-bottom: var(--space-lg);
}

.input-group label {
  display: block;
  font-family: var(--font-text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.29;
  letter-spacing: -0.224px;
  color: var(--ink);
  margin-bottom: var(--space-xs);
}

.url-input {
  width: 100%;
  padding: 12px 20px;
  font-family: var(--font-text);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.47;
  letter-spacing: -0.374px;
  color: var(--ink);
  background-color: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--rounded-pill);
  outline: none;
  transition: border-color 0.2s ease;
}

.url-input::placeholder {
  color: var(--ink-muted-48);
}

.url-input:focus {
  border-color: var(--primary);
}

.url-input.input-error {
  border-color: var(--error);
}

.error-text {
  font-family: var(--font-text);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.43;
  letter-spacing: -0.224px;
  color: var(--error);
  margin-top: var(--space-xs);
}

/* ═══════════════════════════════════════════════════
   Toggle Switch
   ═══════════════════════════════════════════════════ */
.toggle-group {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
}

.toggle-label-text {
  font-family: var(--font-text);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.47;
  letter-spacing: -0.374px;
  color: var(--ink);
  cursor: pointer;
}

.switch {
  position: relative;
  display: inline-block;
  width: 51px;
  height: 31px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--hairline);
  border-radius: 31px;
  transition: background-color 0.3s ease;
}

.slider::before {
  content: '';
  position: absolute;
  height: 27px;
  width: 27px;
  left: 2px;
  bottom: 2px;
  background-color: var(--canvas);
  border-radius: 50%;
  transition: transform 0.3s cubic-bezier(0.45, 0.05, 0.55, 0.95);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

input:checked + .slider {
  background-color: #34c759; /* Apple green toggle */
}

input:checked + .slider::before {
  transform: translateX(20px);
}

/* ═══════════════════════════════════════════════════
   Button — Primary Pill CTA
   Per DESIGN.md: button-primary
   ═══════════════════════════════════════════════════ */
.submit-btn {
  background-color: var(--primary);
  color: var(--on-primary);
  font-family: var(--font-text);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.0;
  letter-spacing: -0.374px;
  border: none;
  border-radius: var(--rounded-pill);
  padding: 11px 22px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  transition: transform 0.15s ease;
}

/* Active/Press: scale(0.95) — the system-wide micro-interaction */
.submit-btn:active {
  transform: scale(0.95);
}

/* Focus: 2px solid primary-focus outline */
.submit-btn:focus-visible {
  outline: 2px solid var(--primary-focus);
  outline-offset: 2px;
}

.submit-btn:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
}

.submit-btn span {
  font-size: 18px;
  font-weight: 400;
  transition: transform 0.2s ease;
}

.submit-btn:active span {
  transform: translateX(2px);
}

/* ═══════════════════════════════════════════════════
   Result Area
   ═══════════════════════════════════════════════════ */
#result-container {
  text-align: center;
  width: 100%;
}

.result-label {
  font-family: var(--font-text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.29;
  letter-spacing: -0.224px;
  color: var(--ink);
  margin-bottom: var(--space-sm);
}

#short-url {
  display: inline-block;
  font-family: var(--font-text);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.47;
  letter-spacing: -0.374px;
  color: var(--primary);
  text-decoration: none;
  word-break: break-all;
}

#short-url:hover {
  text-decoration: underline;
}

/* QR Code — product-level shadow only on imagery */
#qr-code-img {
  margin: var(--space-lg) auto 0;
  max-width: 160px;
  border-radius: var(--rounded-sm);
  /* The single product shadow from DESIGN.md */
  box-shadow: rgba(0, 0, 0, 0.22) 3px 5px 30px 0;
}

#result-placeholder {
  text-align: center;
  width: 100%;
}

#result-placeholder p {
  font-family: var(--font-text);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.47;
  letter-spacing: -0.374px;
  color: var(--ink-muted-48);
}

/* ═══════════════════════════════════════════════════
   Footer — Parchment
   Per DESIGN.md: footer component
   ═══════════════════════════════════════════════════ */
.footer {
  background-color: var(--canvas-parchment);
  padding: var(--space-xl) var(--space-lg);
  text-align: center;
  border-top: 1px solid var(--hairline);
}

.footer p {
  font-family: var(--font-text);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.0;
  letter-spacing: -0.12px;
  color: var(--ink-muted-48);
}

.footer a {
  color: var(--primary);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* ═══════════════════════════════════════════════════
   Responsive
   Per DESIGN.md breakpoints
   ═══════════════════════════════════════════════════ */

/* Tablet portrait: ≤ 833px */
@media (max-width: 833px) {
  .hero {
    min-height: auto;
    padding: var(--space-xxl) var(--space-lg);
  }

  .hero-headline {
    font-size: 40px;
    line-height: 1.1;
  }

  .hero-tagline {
    font-size: 21px;
  }

  .card-content {
    flex-direction: column;
    gap: 0;
  }

  .right-panel {
    border-left: none;
    border-top: 1px solid var(--hairline);
    padding-left: 0;
    padding-top: var(--space-lg);
    margin-top: var(--space-lg);
    min-height: auto;
  }

  .card {
    padding: var(--space-lg);
  }

  .main-section {
    padding: var(--space-xxl) var(--space-md);
  }
}

/* Phone: ≤ 640px */
@media (max-width: 640px) {
  .hero {
    padding: var(--space-xl) var(--space-md);
  }

  .hero-headline {
    font-size: 34px;
    letter-spacing: -0.374px;
  }

  .hero-tagline {
    font-size: 17px;
    line-height: 1.47;
    letter-spacing: -0.374px;
  }

  .main-section {
    padding: var(--space-xl) var(--space-sm);
  }

  .card {
    border-radius: var(--rounded-md);
    padding: var(--space-lg) var(--space-md);
  }

  .submit-btn {
    width: 100%;
    justify-content: center;
  }
}

/* Small phone: ≤ 419px */
@media (max-width: 419px) {
  .hero-headline {
    font-size: 28px;
  }

  .hero-tagline {
    font-size: 14px;
    line-height: 1.43;
    letter-spacing: -0.224px;
  }
}
