/* ============================================================================
   Simi Intake — Round 2 (feedback on the live aurelleatelier site)
   Same visual language as the round-1 intake (css/style.css), evolved.
   Self-contained: system font stacks only, no external fonts or CDNs.
   Mobile-first — she will most likely open this on her phone.
   ========================================================================== */

:root {
  /* --- Palette (identical tokens to round 1, AA-verified there) --- */
  --cream:        #f7f2ea;
  --cream-warm:   #fdfbf7;
  --cream-deep:   #efe7da;
  --espresso:     #2e2620;
  --muted:        #5e564e;
  --burgundy:     #7b2d3a;
  --burgundy-deep:#5e1f2a;
  --gold:         #b08d4c;
  --gold-soft:    #d9c39a;
  --error:        #a32b2b;
  --success:      #3f6b4a;
  --line:         #e0d6c6;

  /* --- Type scale (fluid clamp) --- */
  --step--1: clamp(0.82rem, 0.79rem + 0.15vw, 0.9rem);
  --step-0:  clamp(1rem,   0.95rem + 0.25vw, 1.12rem);
  --step-1:  clamp(1.2rem, 1.1rem  + 0.5vw,  1.45rem);
  --step-2:  clamp(1.5rem, 1.3rem  + 1vw,   2.1rem);
  --step-3:  clamp(2.2rem, 1.8rem  + 2vw,   3.2rem);
  --step-4:  clamp(2.6rem, 1.9rem  + 3.4vw, 4.6rem);

  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
                  Georgia, "Times New Roman", serif;
  --font-body:    system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --space-xs: 0.5rem;
  --space-sm: 0.85rem;
  --space-md: 1.4rem;
  --space-lg: clamp(2.2rem, 1.5rem + 3vw, 4rem);
  --space-xl: clamp(3.5rem, 2rem + 6vw, 7rem);

  --radius: 14px;
  --radius-sm: 9px;
  --shadow-soft: 0 1px 2px rgba(46,38,32,0.04), 0 10px 30px -12px rgba(46,38,32,0.16);
  --shadow-lift: 0 2px 6px rgba(46,38,32,0.06), 0 22px 48px -18px rgba(46,38,32,0.24);
  --measure: 62ch;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---------------------------------------------------------------- Base --- */
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E"),
    radial-gradient(120% 80% at 100% 0%, #fbf7ef 0%, var(--cream) 42%) fixed,
    var(--cream);
  color: var(--espresso);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.62;
  letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, legend {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.01em;
  color: var(--espresso);
  margin: 0 0 var(--space-sm);
}

p { margin: 0 0 var(--space-md); max-width: var(--measure); }

a { color: var(--burgundy); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--burgundy-deep); }

em { font-style: italic; color: var(--burgundy); font-family: var(--font-display); }
strong { font-weight: 600; }

::selection { background: var(--gold-soft); color: var(--espresso); }

/* Global focus-visible — same warm ring as round 1 */
:where(a, button, input, textarea, select, [tabindex]):focus-visible {
  outline: 2px solid var(--burgundy);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 6px rgba(176, 141, 76, 0.22);
}
:where(a, button, input, textarea, select, [tabindex]):focus:not(:focus-visible) {
  outline: none;
}
@supports not selector(:focus-visible) {
  :where(a, button, input, textarea, select, [tabindex]):focus {
    outline: 2px solid var(--burgundy);
    outline-offset: 3px;
  }
}

/* Skip link — hidden until focused */
.r2-visually-hidden:focus {
  position: fixed; top: 12px; left: 12px; width: auto; height: auto;
  clip: auto; margin: 0; padding: 0.7rem 1.1rem;
  background: var(--espresso); color: var(--cream-warm);
  border-radius: var(--radius-sm); z-index: 100; box-shadow: var(--shadow-lift);
}

/* -------------------------------------------------------------- Layout --- */
form#r2-form,
.r2-hero,
.r2-section {
  width: min(100% - 2.4rem, 720px);
  margin-inline: auto;
}
form#r2-form .r2-section,
form#r2-form { width: 100%; }
form#r2-form { width: min(100% - 2.4rem, 720px); }

/* ---------------------------------------------------------------- Hero --- */
.r2-hero {
  padding: var(--space-xl) 0 var(--space-lg);
  text-align: center;
  position: relative;
}
.r2-hero::before {
  content: "";
  display: block;
  width: 56px; height: 56px;
  margin: 0 auto var(--space-md);
  background: var(--burgundy);
  -webkit-mask: var(--bag-mask) center / contain no-repeat;
          mask: var(--bag-mask) center / contain no-repeat;
  --bag-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23000' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round' d='M4.5 8.5h15l-1 12h-13z M8 8.5V7a4 4 0 0 1 8 0v1.5'/%3E%3C/svg%3E");
  opacity: 0.92;
}
.r2-hero h1 {
  font-size: var(--step-4);
  margin-bottom: var(--space-md);
  background: linear-gradient(180deg, var(--espresso) 0%, #4a3d33 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.r2-hero p { margin-inline: auto; font-size: var(--step-1); color: #443a31; }
.r2-hero-cta { margin-top: var(--space-lg); }

/* The big "open your site" button — the star of the page */
.r2-visit-btn {
  display: inline-block;
  font-weight: 600;
  font-size: var(--step-1);
  text-decoration: none;
  color: var(--cream-warm);
  background: linear-gradient(120deg, var(--burgundy), var(--burgundy-deep));
  border: 1.5px solid var(--burgundy-deep);
  border-radius: 999px;
  padding: 1rem 2rem;
  box-shadow: var(--shadow-lift);
  transition: transform 0.18s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
  overflow-wrap: anywhere; /* long domain never overflows a 320px screen */
}
.r2-visit-btn:hover {
  color: var(--cream-warm);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(46,38,32,0.10), 0 26px 56px -18px rgba(94,31,42,0.45);
}
.r2-visit-btn:active { transform: translateY(0); }

/* ------------------------------------------------------------ Sections --- */
.r2-section {
  background: var(--cream-warm);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-lg) clamp(1.2rem, 0.6rem + 3vw, 2.6rem);
  margin-bottom: var(--space-lg);
  box-shadow: var(--shadow-soft);
  position: relative;
}
.r2-section::before {
  content: "";
  position: absolute; inset: 0 auto auto 0;
  width: 46px; height: 3px; margin: -1px 0 0 clamp(1.2rem, 0.6rem + 3vw, 2.6rem);
  background: linear-gradient(90deg, var(--gold), transparent);
  border-radius: 0 0 3px 0;
}
.r2-section h2 { font-size: var(--step-2); margin-bottom: var(--space-sm); }
.r2-intro {
  color: var(--muted);
  font-size: var(--step-0);
  max-width: var(--measure);
  margin-bottom: var(--space-lg);
}

/* ------------------------------------------------------- Live preview --- */
.r2-preview-frame {
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--cream-deep);
  box-shadow: var(--shadow-soft);
}
.r2-preview-frame iframe {
  display: block;
  width: 100%;
  height: min(70vh, 640px);
  min-height: 380px;
  border: none;
  background: var(--cream-warm);
}

/* --------------------------------------------------------- Form fields --- */
label {
  display: block;
  font-weight: 600;
  font-size: var(--step--1);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--espresso);
  margin-bottom: var(--space-xs);
}

input[type="text"],
input[type="email"],
textarea {
  width: 100%;
  font: inherit;
  color: var(--espresso);
  background: var(--cream);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.72rem 0.9rem;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
input::placeholder, textarea::placeholder { color: #a89d8f; }
input[type="text"]:hover,
input[type="email"]:hover,
textarea:hover { border-color: var(--gold-soft); }
input[type="text"]:focus,
input[type="email"]:focus,
textarea:focus { background: var(--cream-warm); border-color: var(--burgundy); }
textarea { resize: vertical; min-height: 4.5rem; line-height: 1.55; }
#r2-open { min-height: 7.5rem; }

/* invalid-field highlight (JS sets aria-invalid) */
input[aria-invalid="true"] {
  border-color: var(--error);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--error) 22%, transparent);
}
.r2-field-error {
  color: var(--error);
  font-size: var(--step--1);
  margin: var(--space-xs) 0 0;
}
.r2-field-error:empty { display: none; }

.r2-hint {
  font-size: var(--step--1);
  color: var(--muted);
  margin: var(--space-xs) 0 0;
  text-transform: none;
  font-weight: 400;
  letter-spacing: 0;
}

/* ------------------------------------------------------- Feedback areas --- */
.r2-area {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--cream);
  padding: var(--space-md);
  margin: 0 0 var(--space-md);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.r2-area:focus-within { border-color: var(--gold-soft); box-shadow: var(--shadow-soft); }
.r2-area legend {
  font-size: var(--step-1);
  padding: 0 0.4rem;
  margin-bottom: var(--space-xs);
}
.r2-area-q {
  color: var(--muted);
  font-size: var(--step-0);
  margin-bottom: var(--space-md);
}
.r2-area-q em { white-space: nowrap; }
.r2-note-label {
  text-transform: none;
  font-weight: 400;
  font-size: var(--step--1);
  color: var(--muted);
  margin-top: var(--space-md);
}

/* Rating pills — real radios, styled via the sibling span.
   The input stays screen-reader- and keyboard-accessible (only visually hidden). */
.r2-pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}
.r2-pills label {
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  cursor: pointer;
  position: relative;
}
.r2-pills input[type="radio"] {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  margin: 0;
}
.r2-pills span {
  display: inline-flex;
  align-items: center;
  min-height: 44px; /* WCAG tap-target floor (DeepSeek w4b-mobile-layout-critique HIGH) */
  font-size: var(--step-0);
  color: var(--espresso);
  background: var(--cream-warm);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 0.55rem 1.1rem;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease),
              color 0.18s var(--ease), transform 0.12s var(--ease);
  user-select: none;
}
.r2-pills label:hover span { border-color: var(--gold-soft); background: var(--cream-warm); }
.r2-pills input:checked + span {
  color: var(--cream-warm);
  background: var(--burgundy);
  border-color: var(--burgundy);
  font-weight: 600;
}
.r2-pills input:focus-visible + span {
  outline: 2px solid var(--burgundy);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px rgba(176, 141, 76, 0.22);
}
.r2-pills input:active + span { transform: scale(0.97); }

/* --------------------------------------------------- Price confirmation --- */
.r2-price-check {
  border: 1.5px solid var(--gold-soft);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--gold) 6%, var(--cream-warm));
  padding: var(--space-md);
  margin: 0 0 var(--space-md);
}
.r2-price-check h3 { font-size: var(--step-1); margin-bottom: var(--space-xs); }
.r2-price {
  font-family: var(--font-display);
  color: var(--burgundy);
  white-space: nowrap;
}
#r2-price-fix-wrap { margin-top: var(--space-md); }
#r2-price-fix-wrap[hidden] { display: none; }

/* --------------------------------------------------- Errors / status --- */
.r2-errors {
  display: none;
  color: var(--error);
  background: color-mix(in srgb, var(--error) 8%, var(--cream-warm));
  border: 1.5px solid color-mix(in srgb, var(--error) 35%, var(--line));
  border-radius: var(--radius-sm);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  font-size: var(--step-0);
  text-align: left;
}
.r2-errors:not(:empty) { display: block; }
.r2-errors ul { margin: 0.4rem 0 0; padding-left: 1.3rem; }
.r2-errors li { margin-bottom: 0.3rem; }

.r2-status {
  margin-top: var(--space-md);
  font-size: var(--step-0);
  min-height: 1.4em;
  text-align: left;
}
.r2-status:empty { display: none; }
.r2-status:not(:empty) {
  padding: var(--space-md);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--success) 8%, var(--cream-warm));
  border: 1.5px solid color-mix(in srgb, var(--success) 30%, var(--line));
  color: var(--success);
}
.r2-status.r2-status-error {
  background: color-mix(in srgb, var(--error) 8%, var(--cream-warm));
  border-color: color-mix(in srgb, var(--error) 35%, var(--line));
  color: var(--error);
}
.r2-status p { margin-bottom: var(--space-xs); max-width: none; }
.r2-status p:last-child { margin-bottom: 0; }

/* -------------------------------------------------------------- Submit --- */
.r2-submit-section { text-align: center; }
.r2-submit-btn {
  font: inherit;
  font-weight: 600;
  font-size: var(--step-1);
  letter-spacing: 0.01em;
  color: var(--cream-warm);
  background: var(--burgundy);
  border: none;
  border-radius: 999px;
  padding: 0.95rem 2.6rem;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: transform 0.18s var(--ease), background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.r2-submit-btn:hover { background: var(--burgundy-deep); transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.r2-submit-btn:active { transform: translateY(0); }
.r2-submit-btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

/* ---------------------------------------------------------- Responsive --- */
@media (max-width: 560px) {
  .r2-section { padding: var(--space-md) var(--space-md); }
  .r2-area { padding: var(--space-sm); }
  .r2-pills { gap: 0.4rem; }
  .r2-pills span { padding: 0.5rem 0.9rem; }
  .r2-submit-btn { width: 100%; }
  .r2-visit-btn { width: 100%; padding: 1rem 1.2rem; font-size: var(--step-0); }
  /* shorter preview on phones so the form is reachable without a marathon scroll
     (DeepSeek w4b-mobile-layout-critique MED) */
  .r2-preview-frame iframe { height: min(50vh, 420px); min-height: 280px; }
}
@media (min-width: 900px) {
  form#r2-form, .r2-hero, .r2-section { width: min(100% - 3rem, 760px); }
  form#r2-form .r2-section { width: 100%; }
}

/* ----------------------------------------------------- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .r2-submit-btn:hover, .r2-submit-btn:active,
  .r2-visit-btn:hover, .r2-visit-btn:active,
  .r2-pills input:active + span { transform: none; }
}
