/* ============================================================
   YAMAS web design system — "Liquid Glass" refresh.
   Brand: navy + medium blue, gold accent, terracotta, cream/white.
   Palette + glass material matched to the native SwiftUI app
   (Theme.swift / HomeDesign.swift / HomeView.swift).
   Existing class names are preserved so all feature pages keep working.
   ============================================================ */
:root {
  --ym-cream:   #FAF6EE;
  --ym-cream-2: #F3ECDD;
  --ym-white:   #FFFFFF;
  --ym-navy:    #0F3358;
  --ym-navy-deep:#081E33;   /* deep navy at the bottom of the home gradient */
  --ym-blue:    #1B4F8C;
  --ym-blue-bright:#2E6FB7;  /* brighter accent that reads on the navy canvas */
  --ym-gold:    #C9A961;
  --ym-taupe:   #6B6358;
  --ym-tan:     #D9D2C2;
  --ym-terra:   #C45A3D;
  --ym-ink:     #1F1F1F;
  --ym-line:    #E7E0D2;

  /* Apple system font — closest match to the native app */
  --ym-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, "Helvetica Neue", Helvetica, Arial, sans-serif;

  /* Glass material (Safari-safe frosted baseline) */
  --glass-blur: 22px;
  --glass-fill: linear-gradient(160deg, rgba(255,255,255,.62), rgba(255,255,255,.42));  /* light pages */
  --glass-fill-navy: linear-gradient(160deg, rgba(22,54,94,.50), rgba(10,28,50,.40));    /* dark canvas */
  --glass-edge: rgba(255,255,255,.7);
  --glass-hairline: rgba(255,255,255,.5);
  --glass-shadow: 0 10px 30px rgba(15,51,88,.14);

  /* Radii */
  --r-lg: 22px;
  --r-md: 14px;
  --r-sm: 10px;

  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--ym-font); color: var(--ym-ink); background: var(--ym-white); line-height: 1.5; overflow-x: hidden; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
html { overflow-x: hidden; max-width: 100%; }

/* Native iOS host: hide the web back button; suppress the login flash during token sign-in. */
html.ym-native #backToApps { display: none !important; }
html.ym-native-pending #gate,
html.ym-native-pending .ym-gate { display: none !important; }

/* ---- Glass utility (chrome surfaces) ---- */
.ym-glass { -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%); backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  background: var(--glass-fill); border: 1px solid var(--glass-hairline); border-top-color: var(--glass-edge);
  box-shadow: var(--glass-shadow), inset 0 1px 0 rgba(255,255,255,.6); border-radius: var(--r-lg); }
.ym-glass.navy { background: var(--glass-fill-navy); box-shadow: 0 10px 30px rgba(2,12,26,.42), inset 0 1px 0 rgba(255,255,255,.3); border-color: rgba(255,255,255,.14); border-top-color: rgba(255,255,255,.5); }

/* ---- Gold Greek-key (meander) divider — tiles across any width ---- */
.ym-greek-key { height: 16px; opacity: .85;
  background: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='16'%3E%3Cpath%20d='M0%2014%20H24%20M0%2014%20V2%20H19%20V11%20H8%20V5%20H15%20V8'%20fill='none'%20stroke='%23C9A961'%20stroke-width='1.6'/%3E%3C/svg%3E") repeat-x left center; }

/* ---- The signature header rule: blue line with gold hairline beneath ---- */
.ym-rule { border-bottom: 1.5px solid var(--ym-blue); box-shadow: 0 1.5px 0 0 var(--ym-gold); }

/* ---- Branded top bar (interior pages) — now a frosted glass bar ---- */
.ym-top { display: flex; align-items: center; gap: 12px; padding: 13px 22px 12px;
  background: rgba(255,255,255,.72); -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(201,169,97,.55); box-shadow: 0 1px 0 0 rgba(201,169,97,.25), 0 6px 20px rgba(15,51,88,.06);
  position: sticky; top: 0; z-index: 5; }
.ym-wordmark { font-weight: 800; font-size: 17px; letter-spacing: 1px; color: var(--ym-navy); }
.ym-wordmark .tag { font-weight: 400; font-size: 11px; letter-spacing: .3px; color: var(--ym-gold); font-style: italic; margin-left: 7px; }
.ym-top .spacer { flex: 1; }
.ym-top .who { font-size: 12px; color: var(--ym-taupe); }

/* ---- Buttons ---- */
.btn { font-family: var(--ym-font); font-size: 12.5px; font-weight: 600; border: 1px solid var(--ym-tan); background: var(--ym-white); color: var(--ym-navy); padding: 7px 14px; border-radius: var(--r-sm); cursor: pointer; text-decoration: none; transition: background .14s, transform .12s, box-shadow .14s; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { background: var(--ym-cream); }
.btn:active { transform: translateY(.5px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--ym-blue); color: #fff; border-color: var(--ym-blue); box-shadow: 0 4px 14px rgba(27,79,140,.22); }
.btn.primary:hover { background: var(--ym-navy); border-color: var(--ym-navy); }
.btn.danger { color: var(--ym-terra); border-color: #e7cabf; background: #fff; }
.btn.danger:hover { background: #fbf1ee; }
.btn.big { font-size: 14px; padding: 10px 20px; border-radius: 12px; }

/* ---- Eyebrow (gold, uppercase) ---- */
.ym-eyebrow { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--ym-gold); }

/* ---- Section title with blue+gold accent bar ---- */
.ym-title { display: flex; align-items: flex-start; gap: 12px; }
.ym-title::before { content: ""; flex: none; width: 6px; align-self: stretch; background: linear-gradient(var(--ym-blue) 0 70%, var(--ym-gold) 70% 100%); border-radius: 2px; }
.ym-title h1 { font-size: 25px; font-weight: 750; letter-spacing: -0.3px; color: var(--ym-navy); }

/* ---- Callout ---- */
.ym-callout { border-left: 4px solid var(--ym-terra); padding: 11px 16px; margin: 6px 0 14px; font-style: italic; color: var(--ym-navy); background: transparent; }

/* ---- Footer tagline ---- */
.ym-foot { text-align: center; font-style: italic; font-size: 11.5px; color: var(--ym-taupe); padding: 22px 0 30px; }
.ym-foot::before { content: ""; display: block; width: 100%; max-width: 760px; margin: 0 auto 14px; height: 0; border-top: .5px solid var(--ym-gold); }

/* ---- Sign-in gate (premium glass card) ---- */
.ym-gate { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 50;
  background:
    radial-gradient(520px 320px at 50% 8%, rgba(201,169,97,.18), transparent 62%),
    linear-gradient(180deg, var(--ym-navy) 0%, var(--ym-navy-deep) 100%); }
.ym-gatebox { background: var(--ym-white); border: 1px solid var(--ym-line); border-top: 4px solid var(--ym-gold); border-radius: var(--r-lg); padding: 36px 30px; width: 360px; max-width: calc(100vw - 36px); text-align: center; box-shadow: 0 24px 60px rgba(4,12,22,.45); }
.ym-gatebox .mark { font-weight: 800; font-size: 27px; letter-spacing: 2px; color: var(--ym-navy); }
.ym-gatebox .greek { font-style: italic; font-size: 12.5px; color: var(--ym-gold); margin: 2px 0 16px; }
.ym-gatebox h2 { font-size: 18px; font-weight: 700; color: var(--ym-navy); margin-bottom: 5px; }
.ym-gatebox p { font-size: 13px; color: var(--ym-taupe); margin-bottom: 18px; }
.ym-gatebox button { width: 100%; font-family: var(--ym-font); font-size: 14px; font-weight: 700; color: #fff; background: var(--ym-blue); border: none; padding: 12px; border-radius: 12px; cursor: pointer; transition: background .14s; box-shadow: 0 6px 18px rgba(27,79,140,.28); }
.ym-gatebox button:hover { background: var(--ym-navy); }
.ym-gateerr { color: var(--ym-terra); font-size: 12.5px; margin-top: 10px; min-height: 16px; }

/* ---- Status pill ---- */
.ym-synced { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; }
.ym-synced.on { background: #e7f1e9; color: #2f7a45; }
.ym-synced.off { background: #fbe9e4; color: var(--ym-terra); }

/* ---- Accessibility floor ---- */
@media (prefers-reduced-transparency: reduce) {
  .ym-top { background: var(--ym-white) !important; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .ym-glass { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--ym-white); }
  .ym-glass.navy { background: rgba(11,32,56,.96); }
}
:focus-visible { outline: 2px solid var(--ym-gold); outline-offset: 2px; }

/* ---- Mobile ---- */
@media (max-width: 560px) {
  .ym-top { flex-wrap: wrap; row-gap: 8px; padding: 12px 16px; }
  .ym-top .who { max-width: 60vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .btn { padding: 7px 11px; }
  .ym-gatebox { width: 100%; max-width: 360px; padding: 28px 22px; }
}
