/* felstar.com — shared styles for index.html and mbti_dino.html */

/* ---------- Tokens ---------- */
:root {
  --bg: #f6f4ef;
  --surface: #fdfcf9;
  --ink: #1a1c1e;
  --ink-2: #474c53;
  --ink-3: #62676f;
  --rule: #e2ddd2;
  --rule-strong: #cfc8ba;
  --accent: #b5302a;
  --accent-ink: #ffffff;
  --accent-wash: #f4e4df;
  --tag-bg: #ece8df;

  --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  --wrap: 72rem;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --radius: 10px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131416;
    --surface: #1a1c1f;
    --ink: #ecebe6;
    --ink-2: #c0c3c8;
    --ink-3: #9297a0;
    --rule: #2a2d31;
    --rule-strong: #3a3e44;
    --accent: #f0745f;
    --accent-ink: #1a0d0b;
    --accent-wash: #2e1f1c;
    --tag-bg: #23262a;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #131416;
  --surface: #1a1c1f;
  --ink: #ecebe6;
  --ink-2: #c0c3c8;
  --ink-3: #9297a0;
  --rule: #2a2d31;
  --rule-strong: #3a3e44;
  --accent: #f0745f;
  --accent-ink: #1a0d0b;
  --accent-wash: #2e1f1c;
  --tag-bg: #23262a;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }

a {
  color: inherit;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color .15s ease, text-decoration-color .15s ease;
}
a:hover { color: var(--accent); text-decoration-color: currentColor; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

::selection { background: var(--accent); color: var(--accent-ink); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0;
  font-optical-sizing: auto;
}

p { margin: 0 0 1em; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  background: var(--ink);
  color: var(--bg);
  padding: .5rem .9rem;
  border-radius: 6px;
  z-index: 100;
  text-decoration: none;
}
.skip-link:focus { top: 1rem; }

.label {
  font-family: var(--font-mono);
  font-size: .75rem;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease;
}
.topbar.is-scrolled { border-bottom-color: var(--rule); }

.topbar .wrap {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  min-height: 4rem;
}

.brand {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  text-decoration: none;
  letter-spacing: -0.01em;
  margin-right: auto;
  display: inline-flex;
  align-items: center;
  gap: .6rem;
}
.brand-mark {
  width: 1.6rem;
  height: 1.6rem;
  flex: none;
}

.nav {
  display: flex;
  gap: 1.5rem;
  font-size: .95rem;
}
.nav a { text-decoration: none; color: var(--ink-2); }
.nav a:hover { color: var(--accent); }

.theme-toggle {
  appearance: none;
  border: 1px solid var(--rule-strong);
  background: transparent;
  color: var(--ink-2);
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  flex: none;
  transition: color .15s ease, border-color .15s ease;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle svg { width: 1.05rem; height: 1.05rem; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

@media (max-width: 720px) {
  .nav .nav-optional { display: none; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  padding: .7rem 1.15rem;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: .95rem;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  border: 1px solid var(--rule-strong);
  color: var(--ink);
  background: transparent;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease, transform .15s ease;
}
.btn:hover { border-color: var(--ink); color: var(--ink); }
.btn svg { width: 1rem; height: 1rem; flex: none; }

.btn-primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ---------- Tags ---------- */
.tags {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.tags li {
  font-family: var(--font-mono);
  font-size: .78rem;
  line-height: 1.2;
  padding: .32rem .55rem;
  border-radius: 5px;
  background: var(--tag-bg);
  color: var(--ink-2);
}

/* ---------- Sections ---------- */
.section {
  padding-block: clamp(3.5rem, 8vw, 6.5rem);
  border-top: 1px solid var(--rule);
}

.section-flush { border-top: 0; }

/* Keep anchor targets clear of the sticky top bar */
[id] { scroll-margin-top: 5rem; }

.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: .75rem;
  margin-bottom: clamp(2rem, 4vw, 3rem);
}
.section-head h2 {
  font-size: clamp(1.9rem, 4vw, 2.75rem);
}
.section-head p {
  color: var(--ink-2);
  max-width: 40rem;
  margin: 0;
}

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--rule);
  padding-block: 2rem calc(2rem + env(safe-area-inset-bottom, 0px));
  color: var(--ink-3);
  font-size: .9rem;
}
.footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 2rem;
  justify-content: space-between;
}
.footer a { color: var(--ink-2); }

/* ---------- Print ---------- */
@media print {
  :root { --bg: #fff; --surface: #fff; --ink: #000; --ink-2: #222; --ink-3: #444; --tag-bg: #f1f1f1; color-scheme: light; }
  .topbar, .theme-toggle, .skip-link, .no-print { display: none !important; }
  .section { padding-block: 1.5rem; break-inside: avoid-page; }
  a { text-decoration: none; }
  details > *:not(summary) { display: block; }
}
