/*
 * 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.
 */
/* Cascade layer order. Declared in full so it can't be reordered by a
   stylesheet that happens to load earlier alphabetically (Propshaft serves
   files in name order, and `components` must always win over `base`). */
@layer tokens, base, components;

@layer tokens {
  :root {
    /* Layout */
    --max-width: 45rem;

    /* Spacing */
    --inline-space: 1ch;
    --content-margin: 1rem;
    /* Geometric ×2 scale. NOTE: this ladder sits one step below the one
       DESIGN.md documents (sm 0.5 / md 1 / lg 1.5 / xl 2.5). Reconciling them
       shifts spacing on every page, so it belongs with the token-hygiene pass
       in design_plan.md — not here. --space-xl extends the scale that ships. */
    --space-sm: 0.25em;
    --space-md: 0.5em;
    --space-lg: 1em;
    --space-xl: 2em;

    /* Radius */
    --radius-sm: 0.5em;
    --radius-md: 1em;
    --radius-lg: 1.25em;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06), 0 1px 1px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 12px 36px rgba(0, 0, 0, 0.10);

    /* Colors */
    /* https://arc.net/l/quote/mlcitvmj */
    --dark-blue: #1B4F72;
    --light-blue: #85C1E9;
    --pomegranate: #CD6155;
    --sunflower: #FEF9E7;

    --color-palette-1: #0D1826;
    --color-palette-2: #0F528C;
    --color-palette-3: #144673;
    --color-palette-4: #63A5BF;
    --color-palette-5: #F2F0E4;

    --color-surface: WhiteSmoke; /* Paper — DESIGN.md - #F5F5F5 */
    --color-theme: var(--dark-blue);
    --color-theme-hover: color-mix(in srgb, var(--color-theme) 90%, var(--color-surface));
    --color-indigo-soft: #54A4D9; /* focus rings, decorative dividers — DESIGN.md */

    --color-text-light: var(--color-surface);
    --color-text: #1A1B22; /* Ink — DESIGN.md, never pure black */
    --color-link: var(--color-palette-2); /* #0F528C — established link blue (Indigo Mid read too violet) */
    --color-text-muted: #6E707C; /* Ink Muted — DESIGN.md */
    --color-heading: var(--color-text);

    --color-border: #7B7D7D; /* established border grey — #DCDCD7 read too faint on the off-white surface */

    --color-button-background-default: var(--color-surface);
    --color-button-background-focus: color-mix(in srgb, var(--color-theme) 8%, var(--color-surface));
    --color-success: #5C9168; /* Signal Success — sage green, DESIGN.md */
    --color-danger: #B23A2A;  /* Signal Danger — terracotta red, DESIGN.md */
    --color-tooltip: Ivory; /* kept for now (de-naming deferred by preference) */
    --color-caption: var(--color-text-muted);
  }
}

@layer base {
  .box {
    box-sizing: border-box;
  }

  /* Offset fragment scrolls so anchored elements clear the sticky navbar. */
  html {
    scroll-padding-top: 6rem;
  }

  body {
    font-family: Helvetica, sans-serif;
    font-weight: 300;
    /* Without this, prose inherits the UA default #000 — the one color
       DESIGN.md's Tinted-Neutral rule prohibits. The token existed and was
       simply never applied to body text. */
    color: var(--color-text);
    background-color: var(--color-surface);
    margin: 0 auto;
    padding: 0;
    line-height: 1.5em;
    list-style-position: outside;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
  }

  main {
    width: min(80%, var(--max-width));
  }

  /* Text selection is a surface we ship whether we draw it or not; the UA
     default is a system blue that belongs to no design system. Indigo Soft at
     low opacity keeps Ink legible underneath, on paper and on the navbar. */
  ::selection {
    background-color: color-mix(in srgb, var(--color-indigo-soft) 45%, transparent);
    color: var(--color-text);
  }

  a, a:visited {
    color: var(--color-link);
  }
  a:hover {
    text-decoration: none;
  }

  figcaption {
    color: var(--color-caption);
  }

  iframe,
  img {
    border-radius: var(--radius-md);
  }

  img.dayImage {
    width: min(150px, var(--max-width));
    height: min(150px, var(--max-width));
    object-fit: cover;
    border-radius: 50%;
    display: block;
    /* margin-left: auto; */
    /* margin-right: auto; */
    margin: 1.5em auto;
    padding: 4px;
    border: 2px solid var(--color-border);
  }

  .eventList li {
      padding: var(--space-md) 0;
  }

  .tripDayNav li.today::after { content: "🎈"; }

  .agentActions {
    border-top: 1px solid var(--color-border);
    padding: var(--space-lg) 0;
    margin: var(--space-lg) 0;
  }
  
  h1, h2, h3, h4, h5, h6 {
    display: block;
    font-weight: 300;
    hyphens: auto;
    margin-block: var(--content-margin);
    overflow-wrap: break-word;
    text-wrap: pretty;
    line-height: 1em;
  }

  h1 { font-size: 2rem; margin: 1em 0 }
  h2 { font-size: 1.5rem; margin: 1em 0; }
  h3 { font-size: 1.25rem; }
  h4 { font-size: 1rem; }
  h5 { font-size: 1rem; }

  h1, h2, h3, h4 {
    text-align: center;
  }

  h2, h3 {
    --divider-color: var(--color-border);

    color: var(--color-heading);
    align-items: center;
    display: flex;
    gap: var(--inline-space);

    &:before,
    &:after {
      background: var(--divider-color);
      block-size: 1px;
      content: "";
      flex: 1;
      /* A long heading on a phone squeezed these to a couple of pixels each,
         which reads as dirt rather than as the signature rule. Holding a
         floor makes the heading text wrap instead — two centred lines
         between two visible rules is the pattern; 2px stubs are not. */
      min-inline-size: 2rem;
    }

    &:before { background: var(--color-border); }
    &:after { background: var(--color-border); }
    /* &:before { background: linear-gradient(to right, transparent, var(--divider-color) 50%); } */
    /* &:after  { background: linear-gradient(to left, transparent, var(--divider-color) 50%); } */
  }
}
