/* IAM App design system — derived from the IAM masthead v2 identity (2026-08-10) */

:root {
  --red: #913630;
  --red-dark: #7f2f2a;
  --blue: #005b87;
  --gold: #eac53e;
  --cream: #faf7ef;
  --cream-deep: #f6f2e8;
  --ink: #16293a;
  --quiet: #6f6553;
  --slate: #4c5964;
  --rule: #e2dbc8;
  --rule-mid: #c9c2b2;
  --card: #ffffff;
  --serif: "EB Garamond", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
}

html { -webkit-text-size-adjust: 100%; }
body.iam-app {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  padding-bottom: max(28px, env(safe-area-inset-bottom));
}
body.iam-app * { box-sizing: border-box; }
body.iam-app img { max-width: 100%; height: auto; display: block; }
body.iam-app a { color: var(--blue); text-decoration: none; }

/* Masthead */
.app-mast {
  background: linear-gradient(180deg, var(--cream-deep) 0%, var(--cream) 100%);
  border-bottom: 1px solid var(--rule);
  padding: calc(14px + env(safe-area-inset-top)) 18px 12px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.app-mast img.wordmark { height: 26px; width: auto; }
.app-mast .screen {
  font-family: var(--serif);
  font-size: 17px;
  font-style: italic;
  color: var(--quiet);
}

/* In-page nav — the app's only tabs are Home + Support, so screens navigate here */
.app-nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; gap: 2px;
  background: var(--cream);
  border-bottom: 1px solid var(--rule);
  padding: 0 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.app-nav::-webkit-scrollbar { display: none; }
.app-nav a {
  flex: 1 0 auto;
  text-align: center;
  font-size: 13px; font-weight: 600; letter-spacing: .04em;
  color: var(--slate);
  padding: 11px 12px 9px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.app-nav a.on { color: var(--red); border-bottom-color: var(--red); }

.app-wrap { padding: 18px 16px 40px; max-width: 640px; margin: 0 auto; }

/* Section headings */
.app-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--red);
  margin: 26px 0 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.app-kicker::after { content: ""; flex: 1; height: 1px; background: var(--rule); }
.app-wrap > .app-kicker:first-child { margin-top: 4px; }

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 14px;
}
.card .pad { padding: 16px; }
.card h2, .card h3 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.25;
  margin: 0 0 6px;
  text-wrap: balance;
}
.card h2 { font-size: 22px; }
.card h3 { font-size: 18px; }
.card .meta { font-size: 12.5px; color: var(--quiet); margin-bottom: 8px; }
.card p.excerpt { font-size: 14.5px; color: var(--slate); margin: 0 0 12px; }
.card .cover { aspect-ratio: 16 / 9; object-fit: cover; width: 100%; }

.btn {
  display: inline-block;
  background: var(--red);
  color: #fff !important;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: 8px;
  border: 0;
}
.btn.quiet { background: transparent; color: var(--blue) !important; border: 1px solid var(--rule-mid); }
.btn:active { background: var(--red-dark); }

/* Episode rows */
.ep {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.ep .top { display: flex; gap: 12px; align-items: flex-start; }
.ep img.art { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; flex: none; }
.ep h3 { font-family: var(--serif); font-size: 17px; font-weight: 600; margin: 0 0 3px; line-height: 1.3; }
.ep .meta { font-size: 12px; color: var(--quiet); }
.ep audio { width: 100%; margin-top: 10px; height: 40px; }
.ep .links { margin-top: 8px; font-size: 13px; }

/* Issues grid */
.issue-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (min-width: 560px) { .issue-grid { grid-template-columns: repeat(3, 1fr); } }
.issue-grid .issue a { display: block; }
.issue-grid .issue a.pdf {
  display: inline-block; margin-top: 4px; font-size: 12px; font-weight: 600;
  color: var(--red); border: 1px solid var(--rule); border-radius: 6px; padding: 3px 9px;
}
.issue-grid img {
  aspect-ratio: 8.5 / 11;
  object-fit: cover;
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--rule);
  background: var(--cream-deep);
}
.issue-grid .t { font-size: 13px; font-weight: 600; color: var(--ink); margin-top: 6px; line-height: 1.3; }
.phone-hint { font-size: 13px; color: var(--quiet); background: var(--cream-deep); border: 1px solid var(--rule); border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; }
@media (min-width: 768px) { .phone-hint { display: none; } }

/* Webinar rows */
.webinar {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}
.webinar .when {
  font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--blue); margin-bottom: 6px;
}
.webinar h3 { font-family: var(--serif); font-size: 18px; font-weight: 600; margin: 0 0 4px; line-height: 1.3; }
.webinar .speaker { font-size: 13.5px; color: var(--quiet); margin-bottom: 12px; }

/* Ad slot */
.app-ad {
  margin: 22px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.app-ad .lbl { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--rule-mid); }

/* Ask */
.ask-page { display: flex; flex-direction: column; min-height: calc(100vh - 60px); }
.ask-thread { flex: 1; padding: 18px 16px 120px; max-width: 640px; margin: 0 auto; width: 100%; }
.msg { margin-bottom: 14px; max-width: 88%; }
.msg .bubble {
  padding: 12px 15px; border-radius: 14px; font-size: 15px; line-height: 1.55;
  white-space: pre-wrap; word-wrap: break-word;
}
.msg.user { margin-left: auto; }
.msg.user .bubble { background: var(--blue); color: #fff; border-bottom-right-radius: 4px; }
.msg.bot .bubble { background: var(--card); border: 1px solid var(--rule); border-bottom-left-radius: 4px; }
.msg .cites { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.msg .cites a {
  font-size: 13px; padding: 8px 12px; background: var(--cream-deep);
  border: 1px solid var(--rule); border-radius: 8px; color: var(--blue);
}
.ask-empty { text-align: center; padding: 48px 24px 24px; }
.ask-empty h2 { font-family: var(--serif); font-size: 26px; font-weight: 600; margin: 0 0 8px; }
.ask-empty p { color: var(--quiet); font-size: 14.5px; max-width: 42ch; margin: 0 auto; }
.ask-bar {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--cream); border-top: 1px solid var(--rule);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}
.ask-bar .inner { display: flex; gap: 10px; max-width: 640px; margin: 0 auto; }
.ask-bar input {
  flex: 1; font: 15px var(--sans); padding: 12px 16px;
  border: 1px solid var(--rule-mid); border-radius: 24px; background: #fff; color: var(--ink);
}
.ask-bar input:focus { outline: 2px solid var(--blue); outline-offset: 0; border-color: var(--blue); }
.ask-bar button {
  background: var(--red); color: #fff; border: 0; border-radius: 24px;
  font: 600 14px var(--sans); padding: 0 20px;
}
.ask-bar button:disabled { opacity: .5; }
.typing { color: var(--quiet); font-size: 13px; padding: 4px 2px; }

/* Footer */
.app-foot {
  border-top: 1px solid var(--rule);
  margin-top: 30px; padding: 20px 16px 10px;
  text-align: center; font-size: 12.5px; color: var(--quiet);
}
.app-foot a { color: var(--blue); }
