/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Fonts (Pretendard Variable, Playfair Display, Noto Serif KR) load from CDN via
   <link> tags in the layout heads — see application.html.erb / immersive.html.erb.
   No self-hosted @font-face here. */

/* All design tokens are now defined once in brand_tokens.css (loaded first).
   This file only carries base element styles + component CSS that consume them. */

* {
  box-sizing: border-box;
  /* Suppress the grey block WebKit paints over whatever you tap; the button system's
     :active states answer the touch instead. Matches the room (front_door.css). */
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans), system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
textarea {
  font: inherit;
}

/* Bare buttons are reset by Tailwind preflight; styling is opt-in via the
   .btn system (app/assets/tailwind/application.css) so it never hijacks utilities. */
button {
  cursor: pointer;
}

/* Room-enter motion, applied via the `motion` Stimulus controller (enterClass).
   Keyframes are an escape hatch utilities can't express — keep here. */
@keyframes founders-room-enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

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

.motion-enter {
  animation: founders-room-enter 180ms ease-out both;
  animation-delay: var(--motion-delay, 0ms);
}

/* ═══ Forms ════════════════════════════════ */

.input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--r-control);
  background: var(--background);
  padding: 0.75rem 1rem;
  color: var(--foreground);
  font-size: 1rem;
  transition: border-color 0.15s;
}

.input::placeholder {
  color: var(--fg-muted);
}

.input:focus {
  outline: none;
  border-color: var(--border-hover);
}

/* Button system unified in app/assets/tailwind/application.css (@layer components). */

/* Markdown-rendered Velros conversational replies in the product room.
   Tailwind preflight strips list/heading styling, so restore the basics here. */
.markdown-body > :first-child {
  margin-top: 0;
}

.markdown-body > :last-child {
  margin-bottom: 0;
}

.markdown-body p {
  margin: 0.5rem 0;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  margin: 1rem 0 0.5rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--foreground);
}

.markdown-body h1 {
  font-size: 1.25rem;
}

.markdown-body h2 {
  font-size: 1.125rem;
}

.markdown-body h3,
.markdown-body h4 {
  font-size: 1rem;
}

.markdown-body ul,
.markdown-body ol {
  margin: 0.5rem 0;
  padding-left: 1.25rem;
}

.markdown-body ul {
  list-style: disc;
}

.markdown-body ol {
  list-style: decimal;
}

.markdown-body li {
  margin: 0.25rem 0;
}

.markdown-body a {
  color: var(--accent-info);
  text-decoration: underline;
}

.markdown-body strong {
  font-weight: 600;
}

.markdown-body em {
  font-style: italic;
}

.markdown-body code {
  font-family: var(--font-mono), monospace;
  font-size: 1rem;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}

.markdown-body pre {
  margin: 0.75rem 0;
  padding: 0.75rem 1rem;
  overflow-x: auto;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.markdown-body pre code {
  background: none;
  border: 0;
  padding: 0;
}

.markdown-body blockquote {
  margin: 0.75rem 0;
  padding-left: 0.875rem;
  border-left: 3px solid var(--border-hover);
  color: var(--fg-secondary);
}

.markdown-body hr {
  margin: 1rem 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.markdown-body table {
  margin: 0.75rem 0;
  width: 100%;
  border-collapse: collapse;
}

.markdown-body th,
.markdown-body td {
  border: 1px solid var(--border);
  padding: 0.375rem 0.625rem;
  text-align: left;
}

.markdown-body th {
  background: var(--bg-surface-hover);
  font-weight: 600;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ═══════════════════════════════════════════════════════════════════════
   Velros Brand — paper / deep-green ink / serif. Canonical: docs/DESIGN.md.
   Tokens are global (brand_tokens.css); the whole app renders on this system.
   `.brand` now only carries the RICH public-page treatment (gradient ground +
   serif) — the app shell uses the flat paper body background.

   COMPONENT LAYER (Tailwind-first policy): the `.brand-*` skin is the public-
   page design system — like the `.btn` system, it's a cohesive set of reusable
   classes, not ad-hoc CSS. It leans on multi-layer gradients, backdrop-filter,
   and untokenized translucent colors that utilities can't express without
   scattering raw colors into markup. Reuse these classes; don't inline-utility
   them. One-off layout/spacing in brand pages still uses utilities.
   ═══════════════════════════════════════════════════════════════════════ */

.brand {
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 50% 0%, rgb(var(--veil-paper-rgb) / 0.96), rgb(var(--veil-paper-rgb) / 0) 38rem),
    radial-gradient(ellipse at 12% 6%, rgb(var(--tint-sage-rgb) / 0.5), rgb(var(--tint-sage-rgb) / 0) 26rem),
    radial-gradient(ellipse at 88% 4%, rgb(var(--tint-sky-rgb) / 0.42), rgb(var(--tint-sky-rgb) / 0) 26rem),
    linear-gradient(180deg, var(--paper), var(--paper-deep));
  color: var(--ink);
  font-family: var(--brand-sans);
  font-size: 1rem;
  line-height: 1.55;
}

/* ── Layout ─────────────────────────────────────────────── */
.brand-container {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.brand-section {
  padding: 5rem 0;
  border-top: 1px solid var(--line);
}

.brand-section:first-of-type {
  border-top: 0;
}

.brand-page {
  padding: 8rem 0 2rem; /* clear the fixed brand header */
}

/* ── Type ───────────────────────────────────────────────── */
.brand-eyebrow {
  font-family: var(--brand-sans);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--green);
}

.brand-h1 {
  font-family: var(--brand-serif);
  color: var(--green);
  font-size: clamp(2.75rem, 7vw, 5.25rem);
  font-weight: 600;
  line-height: 0.95;
  letter-spacing: -0.045em;
  margin: 0;
}

.brand-h1 em {
  font-style: italic;
  font-weight: 430;
}

.brand-h2 {
  font-family: var(--brand-serif);
  color: var(--green);
  font-size: clamp(1.9rem, 4.5vw, 3rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.04em;
  margin: 0;
}

.brand-h3 {
  font-family: var(--brand-serif);
  color: var(--ink);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.1;
  margin: 0;
}

.brand-lede {
  color: var(--ink-soft);
  font-size: 1.18rem;
  line-height: 1.5;
  margin: 1.25rem 0 0;
  max-width: 38rem;
}

.brand-body {
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.55;
}

.brand-muted {
  color: var(--ink-muted);
}

/* ── Cards & grids ──────────────────────────────────────── */
.brand-grid {
  display: grid;
  gap: 1.1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
}

.brand-card {
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: rgb(var(--veil-paper-rgb) / 0.62);
  backdrop-filter: blur(28px) saturate(1.18);
  box-shadow:
    0 1rem 3rem rgb(var(--shadow-ink-rgb) / 0.08),
    inset 0 1px 0 rgb(var(--edge-highlight-rgb) / 0.7);
  padding: 1.5rem;
}

.brand-card__num {
  font-family: var(--brand-sans);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--ink-muted);
}

/* ── Tags / badges ──────────────────────────────────────── */
.brand-tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: rgb(var(--shadow-ink-rgb) / 0.08);
  color: var(--ink-soft);
  padding: 0.2rem 0.55rem;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-tag--live {
  background: var(--moss);
  color: var(--green);
}

/* ── Buttons (one system, brand context) ────────────────── */
.brand-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 1px solid var(--green);
  border-radius: var(--r-chip);
  background: var(--green);
  color: var(--paper-warm);
  padding: 0.7rem 1.3rem;
  font-family: var(--brand-sans);
  font-size: 1rem;
  font-weight: var(--fw-body);
  transition: transform var(--dur-fast) var(--ease-out), background var(--dur) var(--ease-out),
    color var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out);
}

/* web-b2b primary hover: a subtle lift and an ink→paper invert. */
@media (hover: hover) {
  .brand-btn:hover {
    transform: translateY(-1px);
    background: var(--paper-warm);
    border-color: var(--ink);
    color: var(--ink);
  }
}

/* Press — the touch counterpart of that lift, so unlike hover it is not gated: a finger
   has no hover. transition-duration: 0s lands the press on contact; letting go falls back
   to .brand-btn's transition, so the release still eases. */
.brand-btn:active {
  transform: translateY(0) scale(0.97);
  transition-duration: 0s;
}

.brand-btn--ghost {
  background: rgb(var(--veil-paper-rgb) / 0.6);
  border-color: var(--line-strong);
  color: var(--ink-soft);
}

@media (hover: hover) {
  .brand-btn--ghost:hover {
    background: rgb(var(--veil-paper-rgb) / 0.9);
    color: var(--green);
  }
}

.brand-btn--block {
  width: 100%;
}

/* The wizard is one row system. A category and a choice are the same row — full width,
   one per line, the widest and easiest thing a thumb can hit — and differ only in what
   trails the label: a chevron means "this leads somewhere", a tick means "this is picked".
   Wrapped chips read as a word-cloud to scan; rows read as a list to answer, and no label
   changes size or position with its neighbours' lengths.
   JS toggles .is-selected; the sr-only input carries the value so the form submits
   natively. */
.onboarding-family,
.onboarding-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  min-height: 3.5rem;
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: var(--bg-elevated);
  padding: 0.9rem 1.1rem;
  color: var(--foreground);
  font: inherit;
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out),
    background var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}

@media (hover: hover) {
  .onboarding-family:hover,
  .onboarding-option:hover {
    border-color: var(--border-hover);
    background: var(--bg-surface);
  }
}

/* The wizard is picked through on a phone more than anywhere else in the app, so the rows
   answer the finger. Not gated — see .brand-btn:active above. */
.onboarding-family:active,
.onboarding-option:active {
  border-color: var(--border-hover);
  transform: scale(0.98);
  transition-duration: 0s;
}

.onboarding-family__chevron {
  width: 1.15rem;
  height: 1.15rem;
  flex: none;
  color: var(--fg-muted);
}

/* The box that trails a choice: an empty outline until picked, then a tick. The tick is
   drawn by masking a fill, so its colour stays the token and the SVG carries none — a mask
   reads only alpha, which is why the stroke below is a throwaway. Masking also eats the
   outline, so a picked row shows the tick alone.
   Unpicked, the shape is the rule: round means picking this replaces your answer, square
   means it adds to it. */
.onboarding-option__mark {
  flex: none;
  width: 1.3rem;
  height: 1.3rem;
  border: 1.5px solid var(--border-hover);
  border-radius: 999px;
  transition: border-color var(--dur-fast) var(--ease-out),
    background-color var(--dur-fast) var(--ease-out);
}

.onboarding-option:has(input[type="checkbox"]) .onboarding-option__mark {
  border-radius: 0.45rem;
}

.onboarding-option.is-selected .onboarding-option__mark {
  border-color: var(--green);
  background-color: var(--green);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 13 4 4L19 7'/%3E%3C/svg%3E") center / 0.95rem no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 13 4 4L19 7'/%3E%3C/svg%3E") center / 0.95rem no-repeat;
}

/* The column's own insets. The shell sets px-6/py-10; only the safe-area part is added
   here, so a notch never crops the wizard when it runs full-bleed. The bottom is the
   footer's — it is what reaches the edge. */
.onboarding-shell {
  padding-top: calc(2.5rem + env(safe-area-inset-top, 0px));
  padding-left: calc(1.5rem + env(safe-area-inset-left, 0px));
  padding-right: calc(1.5rem + env(safe-area-inset-right, 0px));
}

/* The actions ride the bottom: one row per line makes a 14-choice step ~1300px, so
   "next" would otherwise sit 500px below the fold on a phone.

   Blur with NO fill. `body.brand` paints a gradient (three radials over
   paper→paper-deep), and a bar pinned over it cannot match with a colour — measured at
   1280px, a flat --paper fill jumps 12 levels across its top edge, which is exactly the
   band that showed. Blurring a smooth gradient returns that same gradient, so the bar
   takes its colour from whatever it happens to be over: 2 levels, i.e. the gradient's own
   dithering. Choices passing underneath soften rather than cut, which is the point.

   The negative inline margin cancels the shell's gutter so the blur reaches both edges. */
.onboarding-footer {
  position: sticky;
  bottom: 0;
  z-index: 1;
  margin-inline: -1.5rem;
  padding-inline: 1.5rem;
  padding-block: 1rem;
  padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.onboarding-option.is-selected {
  border-color: var(--green);
  background: var(--base-blue-light);
  color: var(--green);
  font-weight: 600;
}

.onboarding-option:focus-within {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

/* Kakao sign-in — Kakao brand yellow with a dark label (Kakao brand guidelines).
   Overrides .brand-btn's ink→paper hover so it stays Kakao-yellow. The :hover half of
   that override belongs in the query, alongside the .brand-btn:hover it is cancelling —
   left outside, it would be the one rule still reacting to a phantom hover on a phone. */
.brand-btn--kakao {
  background: var(--kakao-yellow);
  border-color: var(--kakao-yellow);
  color: var(--kakao-ink);
}
@media (hover: hover) {
  /* One block, not two. This used to be two consecutive (hover: hover) queries: the first
     re-stated the resting yellow to cancel .brand-btn's ink→paper hover, the second set the
     darker hover shade — so the first block's background/border were dead on arrival and
     only its color survived. Same rendered result, minus the contradiction. */
  .brand-btn--kakao:hover {
    background: var(--kakao-yellow-hover);
    border-color: var(--kakao-yellow-hover);
    color: var(--kakao-ink);
  }
}

.brand-wordmark {
  display: inline-flex;
  align-items: baseline;
  color: var(--green);
  font-family: var(--brand-serif);
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  user-select: none;
}
