/* ==========================================================================
   Life Tools — premium editorial theme
   Warm paper, ink-teal, sunset-gold. Light + automatic dark mode.
   ========================================================================== */

:root {
  color-scheme: light dark;

  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  /* Light — paper */
  --bg: #faf6f0;
  --bg-elev: #fffdf9;
  --ink: #1d2b2a;
  --ink-soft: #5d6b67;
  --line: #e6dfd2;
  --accent: #0f6e6e;
  --accent-strong: #0a5757;
  --gold: #b97e3e;
  --shadow: 0 10px 30px rgba(29, 43, 42, 0.08);
  --hero-scrim: linear-gradient(180deg,
      rgba(13, 26, 25, 0.62) 0%,
      rgba(13, 26, 25, 0.28) 52%,
      rgba(13, 26, 25, 0.58) 100%);
  --topbar-bg: rgba(250, 246, 240, 0.82);
  --code-bg: rgba(29, 43, 42, 0.06);
  --pre-bg: #0e1918;
  --pre-ink: #d8e2dd;
  --btn-primary-ink: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Dark — midnight pine */
    --bg: #101716;
    --bg-elev: #17201f;
    --ink: #e9e4d8;
    --ink-soft: #9aa8a3;
    --line: #2a3634;
    --accent: #57b8b1;
    --accent-strong: #83d0c9;
    --gold: #d9a464;
    --shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
    --hero-scrim: linear-gradient(180deg,
        rgba(8, 15, 14, 0.74) 0%,
        rgba(8, 15, 14, 0.38) 52%,
        rgba(8, 15, 14, 0.68) 100%);
    --topbar-bg: rgba(16, 23, 22, 0.82);
    --code-bg: rgba(233, 228, 216, 0.08);
    --pre-bg: #0a1211;
    --pre-ink: #d3ded9;
    --btn-primary-ink: #0c1a19;
  }
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

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

html {
  scroll-behavior: smooth;
}

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

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

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

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--accent);
  color: #fff;
  padding: 0.6em 1.1em;
  border-radius: 0 0 10px 0;
  text-decoration: none;
  font-weight: 600;
}

.skip-link:focus {
  left: 0;
}

/* --------------------------------------------------------------------------
   Sticky top bar (appears after the hero scrolls away)
   -------------------------------------------------------------------------- */

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  transform: translateY(-100%);
  transition: transform 0.28s var(--ease);
  background: var(--topbar-bg);
  -webkit-backdrop-filter: blur(12px) saturate(1.3);
  backdrop-filter: blur(12px) saturate(1.3);
  border-bottom: 1px solid var(--line);
}

.topbar.is-visible {
  transform: translateY(0);
}

.topbar-inner {
  max-width: 50rem;
  margin: 0 auto;
  padding: 0.68rem clamp(1.25rem, 4vw, 2.5rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.topbar-brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-decoration: none;
}

.topbar-brand span {
  color: var(--gold);
}

.topbar-nav {
  display: flex;
  gap: 1.4rem;
}

.topbar-nav a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color 0.18s var(--ease);
}

.topbar-nav a:hover {
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero {
  position: relative;
  min-height: clamp(320px, 52vh, 540px);
  display: flex;
  align-items: flex-end;
  color: #ffffff;
  background-image:
    var(--hero-scrim),
    url("https://mytools.dev/images/generated/2024-01-28_SilhouetteOnBridgeWatchingSunset.jpeg");
  background-size: cover, cover;
  background-position: center, center 32%;
  background-repeat: no-repeat;
}

.hero-inner {
  width: 100%;
  max-width: 50rem;
  margin: 0 auto;
  padding: 3rem clamp(1.25rem, 4vw, 2.5rem) 3.25rem;
}

.hero-title {
  margin: 0 0 0.6rem;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.5rem, 7vw, 4rem);
  line-height: 1.04;
  letter-spacing: -0.015em;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.35);
}

.hero-tagline {
  margin: 0 0 1.5rem;
  font-size: 1.05rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.84);
  max-width: 34rem;
}

.hero-tagline:empty {
  display: none;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-block;
  padding: 0.6em 1.2em;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.18s var(--ease),
    background-color 0.18s var(--ease),
    border-color 0.18s var(--ease),
    color 0.18s var(--ease);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

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

.btn-primary:hover {
  background: var(--accent-strong);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.38);
  color: #ffffff;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.6);
}

/* --------------------------------------------------------------------------
   Page container
   -------------------------------------------------------------------------- */

.page {
  padding: 2.75rem 0 1rem;
  background: linear-gradient(180deg,
      color-mix(in srgb, var(--gold) 5%, transparent),
      transparent 260px);
}

.page-inner {
  max-width: 50rem;
  margin: 0 auto;
  padding-inline: clamp(1.25rem, 4vw, 2.5rem);
}

/* --------------------------------------------------------------------------
   Headings
   -------------------------------------------------------------------------- */

main h1 {
  margin: 0 0 1.4rem;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 2.1rem;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

main h2 {
  margin: 2.4rem 0 1rem;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.42rem;
  line-height: 1.25;
}

main h2::after {
  content: "";
  display: block;
  width: 2.75rem;
  height: 3px;
  border-radius: 999px;
  background: var(--gold);
  margin-top: 0.55rem;
  opacity: 0.9;
}

main h3 {
  margin: 1.8rem 0 0.75rem;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.18rem;
  line-height: 1.3;
}

main h4,
main h5,
main h6 {
  margin: 1.5rem 0 0.6rem;
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Prose
   -------------------------------------------------------------------------- */

main p {
  margin: 0 0 1.2em;
  line-height: 1.72;
}

main a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent);
  transition:
    color 0.18s var(--ease),
    text-decoration-color 0.18s var(--ease);
}

main a:hover {
  color: var(--accent-strong);
  text-decoration-color: var(--gold);
}

main strong {
  font-weight: 600;
}

main blockquote {
  margin: 1.5rem 0;
  padding: 0.9rem 1.25rem;
  border-left: 3px solid var(--gold);
  border-radius: 0 12px 12px 0;
  background: var(--bg-elev);
  color: var(--ink-soft);
}

main blockquote p:last-child {
  margin-bottom: 0;
}

main hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2.5rem 0;
}

main img {
  border-radius: 12px;
  border: 1px solid var(--line);
}

/* --------------------------------------------------------------------------
   Code
   -------------------------------------------------------------------------- */

main code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.12em 0.4em;
}

main pre {
  margin: 1.5rem 0;
  padding: 1rem 1.2rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--pre-bg);
  color: var(--pre-ink);
  overflow-x: auto;
  line-height: 1.6;
}

main pre code {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  font-size: 0.85rem;
}

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */

main table {
  width: 100%;
  margin: 1.5rem 0;
  border-collapse: collapse;
  font-size: 0.95rem;
}

main th {
  text-align: left;
  font-weight: 600;
  padding: 0.6rem 0.8rem;
  border-bottom: 2px solid var(--line);
}

main td {
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--line);
}

/* --------------------------------------------------------------------------
   Lists
   -------------------------------------------------------------------------- */

main ul,
main ol {
  margin: 0 0 1.5em;
  padding-left: 1.4em;
}

main li {
  margin: 0.3rem 0;
  line-height: 1.6;
}

main li::marker {
  color: var(--gold);
}

/* Link lists with 4 or more items (section indexes, home page, song lists):
   a single vertical list, like the classic layout, with an editorial rule
   between rows. Prose bullet lists keep their ordinary refined-list look.
   Requires :has() — without it, all lists render as ordinary refined lists. */

main ul:has(> li:nth-child(4)):has(> li:first-child > a) {
  padding: 0;
  margin: 0 0 2rem;
  list-style: none;
}

main ul:has(> li:nth-child(4)):has(> li:first-child > a) > li {
  margin: 0;
  border-bottom: 1px solid var(--line);
}

main ul:has(> li:nth-child(4)):has(> li:first-child > a) > li:first-child {
  border-top: 1px solid var(--line);
}

main ul:has(> li:nth-child(4)):has(> li:first-child > a) > li > a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.15rem;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.05rem;
  line-height: 1.4;
  color: var(--ink);
  text-decoration: none;
  transition: color 0.2s var(--ease);
}

main ul:has(> li:nth-child(4)):has(> li:first-child > a) > li > a::after {
  content: "\2192";
  flex: none;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--gold);
  transition:
    transform 0.2s var(--ease),
    color 0.2s var(--ease);
}

main ul:has(> li:nth-child(4)):has(> li:first-child > a) > li:hover > a {
  color: var(--accent);
}

main ul:has(> li:nth-child(4)):has(> li:first-child > a) > li:hover > a::after {
  transform: translateX(4px);
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer {
  margin-top: 3.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--line);
}

.site-footer p {
  margin: 0 0 0.6rem;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--ink-soft);
}

.site-footer a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.site-footer a:hover {
  color: var(--accent-strong);
}

.footer-meta {
  margin-top: 1.25rem !important;
  font-size: 0.8rem !important;
  opacity: 0.75;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 480px) {
  .hero {
    min-height: clamp(280px, 46vh, 420px);
  }

  .hero-inner {
    padding-bottom: 2.5rem;
  }

  .topbar-nav {
    gap: 1rem;
  }

  .topbar-nav a {
    font-size: 0.85rem;
  }

  main h1 {
    font-size: 1.8rem;
  }
}

/* --------------------------------------------------------------------------
   Reduced motion
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .topbar {
    transition: none;
  }
}
