/* ==========================================================================
   05-base.css — Alapvető elem stílusok

   HTML elem szintű alapok. Primitív tokenekre (02-tokens-core.css) és
   brand tokenekre (03-tokens-brand.css) épül.
   ========================================================================== */

@layer base {

  /* ========================================================================
     ROOT ELEMEK
     ======================================================================== */

  html {
    font-family: var(--font-sans);
    line-height: var(--lh-relaxed);
    color-scheme: light;  /* Bővítsd 'light dark'-ra ha dark mode kell */

    /* Anchor-link (#section) scroll offset — sticky header alatt tűnő horgony
       elkerülésére. Default 0 (nem sticky). Sticky header esetén override-old
       projekt szinten, pl.: :root { --scroll-offset: 80px; } vagy
       body { --scroll-offset: var(--space-20); } */
    scroll-padding-block-start: var(--scroll-offset, 0);
  }

  body {
    font-size: var(--text-lead);
    line-height: var(--lh-body);
    color: var(--color-text);
    background-color: var(--color-bg);
    font-weight: var(--fw-regular);
  }

  /* ========================================================================
     CÍMSOROK — ICF skála (Nunito SemiBold, negatív tracking)

     A méretek a 03-tokens-brand.css --text-h* tokenjeiből jönnek.
     ======================================================================== */

  h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: var(--fw-semibold);
    line-height: var(--lh-display);
    letter-spacing: var(--tracking-display);
    color: var(--color-text);
    text-wrap: balance;
  }

  h1 { font-size: var(--text-h1); }
  h2 { font-size: var(--text-h2); }
  h3 { font-size: var(--text-h3); }
  h4 { font-size: var(--text-h4); line-height: var(--lh-snug); }
  h5 { font-size: var(--text-h5); line-height: var(--lh-snug); letter-spacing: 0; }
  h6 { font-size: var(--text-h6); line-height: var(--lh-snug); letter-spacing: 0; }

  /* Mobil — a hero címsor nem fér ki 44px-en kis kijelzőn */
  @media (max-width: 640px) {
    h1 { font-size: 2.125rem; }   /* 34px */
    h2 { font-size: 1.75rem; }    /* 28px */
    h3 { font-size: 1.375rem; }   /* 22px */
  }

  /* ========================================================================
     SZÖVEG ELEMEK
     ======================================================================== */

  p {
    max-width: var(--container-prose);  /* Olvashatóság — ne legyen túl széles sor */
  }

  small {
    font-size: var(--text-sm);
  }

  strong, b {
    font-weight: var(--fw-semibold);
  }

  em, i {
    font-style: italic;
  }

  /* ========================================================================
     LINKEK
     ======================================================================== */

  a {
    color: var(--color-primary);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
    transition: color var(--duration-base) var(--ease);
  }

  a:hover {
    color: var(--color-primary-hover);
  }

  a:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 3px;
    border-radius: var(--radius-sm);
  }

  /* ========================================================================
     LISTÁK — folyószöveg kontextusban
     ======================================================================== */

  ul, ol {
    padding-inline-start: 1.5em;
  }

  ul { list-style: disc; }
  ol { list-style: decimal; }

  li + li {
    margin-block-start: var(--space-1);
  }

  /* ========================================================================
     IDÉZET
     ======================================================================== */

  blockquote {
    border-inline-start: 3px solid var(--color-primary);
    padding-inline-start: var(--space-4);
    font-style: italic;
    color: var(--color-text-muted);
  }

  /* ========================================================================
     KÓD
     ======================================================================== */

  code,
  kbd,
  samp,
  pre {
    font-family: var(--font-mono);
    font-size: 0.9em;
  }

  code {
    padding: 0.125em 0.375em;
    background-color: var(--color-bg-muted);
    border-radius: var(--radius-sm);
  }

  pre {
    padding: var(--space-4);
    background-color: var(--color-bg-muted);
    border-radius: var(--radius-md);
    overflow-x: auto;
    line-height: var(--lh-normal);
  }

  pre code {
    padding: 0;
    background: none;
  }

  /* ========================================================================
     ELVÁLASZTÓ
     ======================================================================== */

  hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin-block: var(--space-6);
  }

  /* ========================================================================
     FORM ELEMEK — alap
     ======================================================================== */

  label {
    display: inline-block;
    font-weight: var(--fw-medium);
    font-size: var(--text-sm);
    color: var(--color-text);
  }

  input,
  textarea,
  select {
    padding: var(--space-3) var(--space-4);
    background-color: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text);
    transition: border-color var(--duration-base) var(--ease);
  }

  input:focus-visible,
  textarea:focus-visible,
  select:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 3px;
    border-color: var(--color-border-focus);
  }

  ::placeholder {
    color: var(--color-text-subtle);
    opacity: 1;
  }

  /* ========================================================================
     TÁBLÁZAT
     ======================================================================== */

  table {
    width: 100%;
    border-collapse: collapse;
  }

  th, td {
    padding: var(--space-3) var(--space-4);
    text-align: start;
    border-bottom: 1px solid var(--color-border);
  }

  th {
    font-weight: var(--fw-semibold);
    color: var(--color-text);
  }

  /* ========================================================================
     KÉP — semantikus alapok
     ======================================================================== */

  figure {
    margin: 0;
  }

  figcaption {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin-block-start: var(--space-2);
  }

  /* ========================================================================
     SELECTION
     ======================================================================== */

  ::selection {
    background-color: var(--color-primary);
    color: var(--color-text-invert);
  }

}
