/* Tailwind v4 via CDN is loaded separately — this file holds the Apple-style design tokens and overrides */

/* =========================================
   Design Tokens (from DESIGN.md)
   ========================================= */
:root {
  /* Brand & Accent */
  --color-primary: #0066cc;          /* Action Blue */
  --color-primary-light: #0071e3;    /* Focus Blue */
  --color-primary-focus: #0071e3;
  --color-primary-on-dark: #2997ff;  /* Sky Link Blue for dark surfaces */
  --color-accent: #0066cc;           /* Alias — single accent system */

  /* Surface */
  --color-canvas: #ffffff;
  --color-canvas-parchment: #f5f5f7;
  --color-surface: #f5f5f7;          /* Alias — parchment as page surface */
  --color-surface-pearl: #fafafc;
  --color-surface-tile-1: #272729;
  --color-surface-tile-2: #2a2a2c;
  --color-surface-tile-3: #252527;
  --color-surface-black: #000000;
  --color-surface-chip: rgba(210, 210, 215, 0.64);

  /* Text */
  --color-ink: #1d1d1f;
  --color-body: #1d1d1f;
  --color-body-on-dark: #ffffff;
  --color-body-muted: #cccccc;
  --color-ink-muted-80: #333333;
  --color-ink-muted-48: #7a7a7a;
  --color-muted: #7a7a7a;            /* Alias */

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

  /* Functional (semantic — kept for app-level signals) */
  --color-success: #34c759;          /* Apple system green */
  --color-success-soft: #e8f8ed;
  --color-warning: #ff9500;          /* Apple system orange */
  --color-danger: #ff3b30;           /* Apple system red */

  /* Warm supplementary tones — used sparingly for status badges and warmth */
  --color-warm-bg: #faf5ec;          /* Soft beige tile */
  --color-warm-border: #e8dcc4;
  --color-warm-ink: #7a5e2e;

  /* Radius */
  --rounded-none: 0px;
  --rounded-xs: 5px;
  --rounded-sm: 8px;
  --rounded-md: 11px;
  --rounded-lg: 18px;
  --rounded-pill: 9999px;
  --rounded-full: 9999px;

  /* Shadow — the single product shadow */
  --shadow-product: rgba(0, 0, 0, 0.22) 3px 5px 30px;

  /* Font stacks: SF Pro Display/Text with Pretendard fallback for Korean */
  --font-display: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Pretendard Variable', Pretendard, system-ui, sans-serif;
  --font-text:    'SF Pro Text', -apple-system, BlinkMacSystemFont, 'Pretendard Variable', Pretendard, system-ui, sans-serif;
}

/* =========================================
   Base
   ========================================= */
body {
  font-family: var(--font-text);
  background: var(--color-canvas);
  color: var(--color-ink);
  -webkit-font-smoothing: antialiased;
  font-size: 17px;
  line-height: 1.47;
  letter-spacing: -0.374px;
}

/* Apple "tight" headlines — color is inherited from parent so heroes on
   dark/colored backgrounds (text-white, etc.) stay readable. Body sets
   the default ink color via inheritance for plain content. */
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.28px;
}

a { color: var(--color-primary); }

/* =========================================
   Form controls
   ========================================= */
input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
input[type="password"],
input[type="tel"],
select,
textarea {
  font-size: 16px;
  font-family: var(--font-text);
}

/* Form input — pill-shaped, hairline border, single Action Blue focus */
.form-input {
  width: 100%;
  padding: 0.625rem 1rem;
  border: 1px solid var(--color-hairline);
  border-radius: var(--rounded-md);
  font-size: 15px;
  outline: none;
  background: var(--color-canvas);
  color: var(--color-ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus {
  border-color: var(--color-primary-focus);
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.15);
}

/* Radio option — pill chip; selected = Action Blue ring */
.radio-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  border: 1px solid var(--color-hairline);
  border-radius: var(--rounded-pill);
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  color: var(--color-ink-muted-80);
  background: var(--color-canvas);
}
.radio-option:hover { border-color: var(--color-ink-muted-48); }
.radio-option.active {
  border-color: var(--color-primary);
  background: var(--color-canvas);
  color: var(--color-primary);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--color-primary);
}
.radio-option input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
}

/* =========================================
   Buttons (Apple pill + utility grammar)
   ========================================= */
.calc-btn {
  width: 100%;
  padding: 0.75rem 1.25rem;
  border-radius: var(--rounded-pill);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.224px;
  transition: transform 0.1s ease, background 0.15s, color 0.15s;
  cursor: pointer;
  border: none;
  font-family: var(--font-text);
}
.calc-btn:active { transform: scale(0.97); }

.calc-btn-primary {
  background: var(--color-primary);
  color: #fff;
}
.calc-btn-primary:hover { background: var(--color-primary-focus); }

.calc-btn-secondary {
  background: var(--color-surface-pearl);
  color: var(--color-ink-muted-80);
  border: 1px solid var(--color-hairline);
}
.calc-btn-secondary:hover { background: var(--color-canvas-parchment); }

/* Reusable Apple-style pill buttons */
.btn-pill-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 11px 22px;
  border-radius: var(--rounded-pill);
  background: var(--color-primary);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.224px;
  border: none;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s;
  text-decoration: none;
  font-family: var(--font-text);
}
.btn-pill-primary:hover { background: var(--color-primary-focus); color:#fff; }
.btn-pill-primary:active { transform: scale(0.97); }

.btn-pill-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 10px 22px;
  border-radius: var(--rounded-pill);
  background: transparent;
  color: var(--color-primary);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.224px;
  border: 1px solid var(--color-primary);
  cursor: pointer;
  transition: transform 0.1s, background 0.15s;
  text-decoration: none;
  font-family: var(--font-text);
}
.btn-pill-secondary:hover { background: rgba(0,102,204,0.06); }
.btn-pill-secondary:active { transform: scale(0.97); }

/* =========================================
   Result cards & condition items
   ========================================= */
.result-card {
  border-radius: var(--rounded-lg);
  border: 1px solid var(--color-hairline);
  padding: 1.5rem;
  background: var(--color-canvas);
}
.result-pass        { background: #f0fdf4; border-color: #bbf7d0; }
.result-fail        { background: #fef2f2; border-color: #fecaca; }
.result-conditional { background: #fffbeb; border-color: #fde68a; }
.result-info        { background: rgba(0,102,204,0.06); border-color: rgba(0,102,204,0.2); }

.condition-pass {
  padding: 0.75rem 1rem;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--rounded-md);
}
.condition-fail {
  padding: 0.75rem 1rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--rounded-md);
}

/* Score bar */
.score-bar-track {
  width: 100%;
  height: 0.75rem;
  background: var(--color-canvas-parchment);
  border-radius: var(--rounded-pill);
  overflow: hidden;
}
.score-bar-fill {
  height: 100%;
  border-radius: var(--rounded-pill);
  transition: width 0.5s ease-out;
  background: var(--color-primary);
}

/* Disclaimer */
.disclaimer-box {
  margin-top: 2rem;
  padding: 1rem 1.25rem;
  background: var(--color-canvas-parchment);
  border: 1px solid var(--color-hairline);
  border-radius: var(--rounded-md);
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  color: var(--color-ink-muted-80);
  font-size: 13px;
  line-height: 1.5;
}

/* FAQ details — Apple hairline card, no shadow */
details.faq-item {
  border: 1px solid var(--color-hairline);
  border-radius: var(--rounded-md);
  overflow: hidden;
  background: var(--color-canvas);
}
details.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.125rem 1.25rem;
  cursor: pointer;
  background: var(--color-canvas);
  transition: background 0.15s;
  font-weight: 600;
  color: var(--color-ink);
}
details.faq-item summary:hover { background: var(--color-canvas-parchment); }
details.faq-item[open] summary .faq-chevron { transform: rotate(180deg); }
details.faq-item .faq-content {
  padding: 0 1.25rem 1.125rem;
  font-size: 15px;
  color: var(--color-ink-muted-80);
  line-height: 1.6;
  border-top: 1px solid var(--color-divider-soft);
  padding-top: 0.875rem;
}

/* Ad placeholder */
.ad-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-canvas-parchment);
  border: 1px dashed var(--color-hairline);
  border-radius: var(--rounded-md);
  font-size: 12px;
  color: var(--color-ink-muted-48);
  height: 90px;
}

/* Deposit table */
.deposit-table {
  width: 100%;
  font-size: 14px;
  border-collapse: collapse;
}
.deposit-table th, .deposit-table td {
  border: 1px solid var(--color-hairline);
  padding: 0.75rem;
}
.deposit-table th {
  background: var(--color-canvas-parchment);
  font-weight: 600;
  color: var(--color-ink-muted-80);
}
.deposit-table .highlight-cell {
  background: rgba(0,102,204,0.1);
  color: var(--color-primary);
  font-weight: 700;
}
.deposit-table .highlight-row { background: rgba(0,102,204,0.05); }
.deposit-table .highlight-col {
  color: var(--color-primary);
  font-weight: 500;
}

/* Repeater field */
.repeater-item {
  position: relative;
  padding: 1rem 1.25rem;
  border: 1px solid var(--color-hairline);
  border-radius: var(--rounded-md);
  background: var(--color-canvas-parchment);
}
.repeater-add {
  margin-top: 0.5rem;
  width: 100%;
  padding: 0.75rem;
  border: 1px dashed var(--color-hairline);
  border-radius: var(--rounded-md);
  font-size: 14px;
  color: var(--color-ink-muted-48);
  background: transparent;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.repeater-add:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.repeater-remove {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 1.75rem;
  height: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-ink-muted-48);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  border-radius: var(--rounded-full);
  transition: color 0.15s, background 0.15s;
}
.repeater-remove:hover { color: var(--color-danger); background: var(--color-canvas-parchment); }

/* Timeline */
.timeline-line {
  position: absolute;
  left: 1.25rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--color-divider-soft);
}
.timeline-dot {
  position: absolute;
  left: 0.875rem;
  top: 0.25rem;
  width: 0.875rem;
  height: 0.875rem;
  border-radius: var(--rounded-full);
  border: 2px solid var(--color-hairline);
  background: var(--color-canvas);
}
.timeline-dot.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

/* Cutline region card */
.cutline-card { padding: 0.875rem 1rem; border-radius: var(--rounded-md); border: 1px solid var(--color-hairline); }
.cutline-high   { background: #f0fdf4; border-color: #bbf7d0; }
.cutline-medium { background: #fffbeb; border-color: #fde68a; }
.cutline-low    { background: #fef2f2; border-color: #fecaca; }

/* Stacked bar */
.stacked-bar {
  width: 100%;
  height: 1.25rem;
  background: var(--color-canvas-parchment);
  border-radius: var(--rounded-pill);
  overflow: hidden;
  display: flex;
}
.stacked-bar > div { height: 100%; transition: width 0.5s; }

/* =========================================
   Sitewide gradient → Action Blue override
   Replaces legacy navy→blue gradient CTAs
   ========================================= */
[style*="linear-gradient(135deg, #1e3a5f, #3b82f6)"],
[style*="linear-gradient(135deg,#1e3a5f,#3b82f6)"] {
  background: var(--color-primary) !important;
  background-image: none !important;
  border-radius: var(--rounded-pill) !important;
}

/* =========================================
   Utility cards (Apple store-utility-card style)
   ========================================= */
.apple-card {
  background: var(--color-canvas);
  border: 1px solid var(--color-hairline);
  border-radius: var(--rounded-lg);
  padding: 1.5rem;
  transition: transform 0.2s;
}
.apple-card:hover { transform: translateY(-2px); }

/* Monochromatic icon glyph used at the top of cards */
.apple-icon {
  width: 28px;
  height: 28px;
  color: var(--color-ink-muted-48);
  stroke-width: 1.4;
  margin-bottom: 16px;
  transition: color 0.2s;
}
.apple-card-flat:hover .apple-icon { color: var(--color-primary); }

/* Warm-tone "new" badge */
.apple-badge-new {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: -0.12px;
  padding: 3px 8px;
  border-radius: 9999px;
  background: var(--color-warm-bg);
  color: var(--color-warm-ink);
  border: 1px solid var(--color-warm-border);
}

/* Product shadow — reserved for product imagery only */
.product-shadow { box-shadow: var(--shadow-product); }

/* =========================================
   Apple page-level components
   ========================================= */
.apple-hero-display {
  font-family: var(--font-display);
  font-size: clamp(36px, 6vw, 64px);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.022em;
  color: var(--color-ink);
}
.apple-section-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 3.6vw, 40px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.018em;
  color: var(--color-ink);
}
.apple-section-title-dark { color: #fff !important; }

.apple-lead {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0.011em;
  color: var(--color-ink-muted-80);
}
.apple-lead-sm {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.45;
  color: var(--color-ink-muted-80);
}

.apple-tile-light     { background: var(--color-canvas); }
.apple-tile-parchment { background: var(--color-canvas-parchment); }
.apple-tile-dark {
  background: var(--color-surface-tile-1);
  color: var(--color-body-on-dark);
}
.apple-tile-dark .apple-section-title { color: #fff; }
.apple-tile-dark a:not(.btn-pill-primary):not(.btn-pill-secondary) {
  color: var(--color-primary-on-dark);
}

.apple-card-flat {
  background: var(--color-canvas);
  border: 1px solid var(--color-hairline);
  border-radius: var(--rounded-lg);
  padding: 24px;
  transition: transform 0.2s ease, border-color 0.2s ease;
  display: block;
  text-decoration: none;
  color: var(--color-ink);
}
.apple-card-flat:hover {
  transform: translateY(-2px);
  border-color: var(--color-ink-muted-48);
}

.apple-eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.224px;
  color: var(--color-primary);
  margin-bottom: 8px;
}

.apple-link {
  color: var(--color-primary);
  font-size: 15px;
  letter-spacing: -0.224px;
}
.apple-link:hover { text-decoration: underline; }

.apple-page-hero {
  background: var(--color-canvas);
  padding: 80px 0 56px;
  text-align: center;
}
.apple-page-hero-parchment {
  background: var(--color-canvas-parchment);
  padding: 80px 0 56px;
  text-align: center;
}

/* Live indicator: Apple system green */
.apple-live-dot {
  width: 6px; height: 6px; border-radius: 9999px;
  background: var(--color-success);
  box-shadow: 0 0 0 4px rgba(52,199,89,0.18);
  animation: pulse-soft 2s ease-out infinite;
}
@keyframes pulse-soft {
  0%   { box-shadow: 0 0 0 0px rgba(52,199,89,0.35); }
  70%  { box-shadow: 0 0 0 8px rgba(52,199,89,0); }
  100% { box-shadow: 0 0 0 0px rgba(52,199,89,0); }
}

/* Breadcrumb */
.apple-crumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--color-ink-muted-48);
  letter-spacing: -0.224px;
}
.apple-crumb a { color: var(--color-ink-muted-48); }
.apple-crumb a:hover { color: var(--color-primary); }

/* Section title clusters */
.apple-section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
}
