/* ==========================================================================
   Talon First — Global Site Styles
   Structure: CSS Variables → Base → Layout → Components → Utilities → Overrides
   ========================================================================== */

/* ------------------------------
   CSS Variables
   ------------------------------ */
:root{
  /* Color system */
  --tf-bg: #ffffff;
  --tf-surface: #f6f7f8;
  --tf-text: #101214;
  --tf-muted: #5b6168;
  --tf-accent: #1f73b7;      /* link/nav focus */
  --tf-border: #e1e5ea;

  /* Spacing scale (fluid) */
  --space-1: clamp(0.25rem, 0.25rem + 0.1vw, 0.35rem);
  --space-2: clamp(0.5rem, 0.45rem + 0.2vw, 0.75rem);
  --space-3: clamp(0.75rem, 0.7rem + 0.4vw, 1rem);
  --space-4: clamp(1rem, 0.9rem + 0.8vw, 1.5rem);
  --space-5: clamp(1.5rem, 1.2rem + 1.5vw, 2.25rem);
  --space-6: clamp(2rem, 1.6rem + 2vw, 3rem);

  /* Typography */
  --tf-font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";

  /* Sizing */
  --container: min(90rem, 92vw);
  --header-height: 64px;
}

/* ------------------------------
   Base / Resets
   ------------------------------ */
*{ box-sizing: border-box; }
html, body{ height:100%; }
html{ scroll-behavior: smooth; }
body{
  margin:0;
  color:var(--tf-text);
  background:var(--tf-bg);
  font-family:var(--tf-font);
  line-height:1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img{ max-width:100%; height:auto; display:block; }
a{ color: var(--tf-accent); text-decoration: none; }
a:hover{ text-decoration: underline; }
.visually-hidden{ position:absolute !important; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; border:0; }

/* Keyboard focus */
:focus-visible{
  outline: 3px solid var(--tf-accent);
  outline-offset: 2px;
}

/* Skip link */
.skip-link{
  position:absolute; left:-999rem; top:0;
  background:var(--tf-accent); color:white; padding:var(--space-2) var(--space-3); z-index:9999;
  border-radius: 6px;
}
.skip-link:focus{ left: var(--space-3); top: var(--space-3); }

/* ------------------------------
   Layout: Header / Main / Footer
   ------------------------------ */
.container{ width:var(--container); margin-inline:auto; padding-inline: var(--space-4); }
main{ display:block; }

.site-header{
  position: relative;
  border-bottom:1px solid var(--tf-border);
  background: var(--tf-bg);
}
.site-header__inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  min-height: var(--header-height);
  gap: var(--space-4);
}

.site-header a,
.site-header a:visited {
  color: var(--text-color, #111) !important;
}
.site-header a:hover,
.site-header a:focus {
  color: var(--link-hover, #000) !important;
}

/* Logo */
.brand{
  display:flex; align-items:center; gap: var(--space-3);
  text-decoration: none;
}
.brand__mark{
  width: clamp(160px, 18vw, 240px);
  height: auto;
}

/* Primary Nav */
.nav-toggle{
  display: inline-flex; align-items:center; justify-content:center;
  width: 42px; height: 42px; border-radius:8px;
  border:1px solid var(--tf-border);
  background: var(--tf-surface);
  cursor:pointer;
}
.nav-toggle:focus-visible{ box-shadow: 0 0 0 3px rgba(31,115,183,0.35); }
.nav-toggle__label{ font-size: 0.9rem; color: #000 !important;}

.site-nav{
  --gap: var(--space-4);
}
.site-nav__list{
  list-style:none; padding:0; margin:0; display:flex; align-items:center; gap: var(--gap);
}
.site-nav__link{
  display:inline-block; padding: var(--space-2) var(--space-2);
  border-radius: 6px; color: inherit;
}
.site-nav__link[aria-current="page"]{ font-weight:600; }
.site-nav__link:focus-visible{ background: var(--tf-surface); }

/* Mobile behavior */
@media (max-width: 768px){
  .site-header__inner{ flex-wrap:wrap; }
  .nav-toggle{ order: 2; }
  .site-nav{
    width:100%;
    display:none;
    border-top:1px solid var(--tf-border);
    padding-block: var(--space-3);
  }
  .site-nav.is-open{ display:block; }
  .site-nav__list{
    flex-direction:column; align-items:flex-start;
  }
}

/* Desktop: show nav, hide toggle */
@media (min-width: 769px){
  .nav-toggle{ display:none; }
  .site-nav{ display: block !important; }
}

/* Footer */
.site-footer{
  border-top:1px solid var(--tf-border);
  background: var(--tf-surface);
  margin-top: var(--space-6);
  padding-block: var(--space-5);
  color: var(--tf-muted);
  font-size: 0.94rem;
}
.site-footer__grid{
  display:grid; gap: var(--space-4);
}
@media (min-width: 768px){
  .site-footer__grid{ grid-template-columns: 1fr auto; align-items:center; }
}
.site-footer a{ color: inherit; }
.site-footer__legal{ opacity: 0.9; }

/* Utilities */
.u-hide{ display:none !important; }
.u-flex{ display:flex; }
.u-mt-0{ margin-top:0 !important; }
.u-mb-0{ margin-bottom:0 !important; }
.u-stack > * + *{ margin-top: var(--space-2); }

/* ------------------------------
   Per-page Overrides (optional)
   Add tiny page-specific rules below; keep minimal to preserve maintainability.
   ------------------------------ */
/* Example:
  .home-hero{ background: #eef6ff; }
*/

/* ------------------------------
   Components: Buttons / Tags / Cards / Notices
   ------------------------------ */
.btn{
  display:inline-flex; align-items:center; justify-content:center;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--tf-border);
  background: var(--tf-text);
  color: var(--tf-bg);
  text-decoration:none;
  font-weight:600;
  line-height:1;
  gap: .5rem;
}
.btn:hover{ text-decoration:none; filter: brightness(0.95); }
.btn:focus-visible{ box-shadow: 0 0 0 3px rgba(31,115,183,0.35); }

.btn--ghost{
  background: transparent;
  color: var(--tf-text);
}
.btn--sm{ padding: 0.55rem 0.8rem; border-radius: 10px; font-size: 0.95rem; }

.pill{
  display:inline-flex; align-items:center;
  padding: .25rem .6rem;
  border-radius: 999px;
  border: 1px solid var(--tf-border);
  background: var(--tf-surface);
  color: var(--tf-muted);
  font-size: 0.9rem;
  white-space:nowrap;
}

.tag{
  display:inline-flex; align-items:center;
  padding: .2rem .55rem;
  border-radius: 999px;
  border: 1px solid var(--tf-border);
  background: var(--tf-bg);
  color: var(--tf-muted);
  font-size: 0.85rem;
}

.home-hero{
  padding-block: var(--space-6);
  background: linear-gradient(180deg, var(--tf-surface), var(--tf-bg));
  border-bottom: 1px solid var(--tf-border);
}
.home-hero__inner{
  display:grid;
  gap: var(--space-5);
}
/* ------------------------------
   Home: Panoramic banner (beneath header)
   ------------------------------ */
.home-banner{
  border-bottom: 1px solid var(--tf-border);
  background: #000; /* prevents white flash while image loads */
}
.home-banner__media{
  width: 100%;
  aspect-ratio: 4 / 1; /* desktop shows full panorama */
  overflow: hidden;
}
.home-banner__img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%; /* keep the “middle third” the priority */
}

/* Tablets: crop a bit more (roughly middle ~3/5 visible) */
@media (max-width: 1024px){
  .home-banner__media{ aspect-ratio: 3 / 1; }
}

/* Phones: crop more (prioritize middle third) */
@media (max-width: 600px){
  .home-banner__media{ aspect-ratio: 2 / 1; }
}

@media (min-width: 960px){
  .home-hero__inner{ grid-template-columns: 1.5fr 1fr; align-items:start; }
}
.home-hero__title{
  margin:0 0 12px 0;
  font-size: clamp(2rem, 1.5rem + 2vw, 3rem);
  letter-spacing: -0.02em;
  line-height: 2.9rem;
  padding-bottom: 6px;
}
.home-hero__lead{ margin:0; color: var(--tf-muted); max-width: 65ch; }
.home-hero__actions{ display:flex; flex-wrap:wrap; gap: var(--space-3); margin-top: var(--space-3); }
.home-hero__meta{ display:flex; flex-wrap:wrap; gap: var(--space-2); margin-top: var(--space-3); }

.home-hero__panel{
  border:1px solid var(--tf-border);
  background: var(--tf-bg);
  border-radius: 16px;
  padding: var(--space-4);
  box-shadow: 0 8px 18px rgba(16,18,20,0.06);
}
.home-hero__panelTitle{ margin:0 0 var(--space-2) 0; font-size: 1.05rem; }
.home-hero__steps{ margin:0; padding-left: 1.1rem; color: var(--tf-muted); }
.home-hero__panelHint{ margin: var(--space-3) 0 0 0; color: var(--tf-muted); font-size: 0.95rem; }

.home-section{
  padding-block: var(--space-6);
}
.home-section--alt{
  background: var(--tf-surface);
  border-top: 1px solid var(--tf-border);
  border-bottom: 1px solid var(--tf-border);
}

.section-head{ max-width: 70ch; }
.section-head__title{ margin:0; font-size: clamp(1.5rem, 1.25rem + 1vw, 2rem); }
.section-head__sub{ margin: var(--space-2) 0 0 0; color: var(--tf-muted); }

.card-grid{
  display:grid;
  gap: var(--space-4);
  margin-top: var(--space-4);
}
@media (min-width: 720px){
  .card-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1080px){
  .card-grid{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.card{
  border: 1px solid var(--tf-border);
  background: var(--tf-bg);
  border-radius: 18px;
  overflow:hidden;
  display:flex;
  flex-direction:column;
  min-height: 210px;
  box-shadow: 0 10px 22px rgba(16,18,20,0.05);
}
.card--icon{
  position: relative;
}

.card__icon{
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 100px;
  height: 100px;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  z-index: 2;
}

.card--icon .card__body{
  /* Reserve space so titles/text don't run under the icon */
  padding-right: calc(var(--space-4) + 110px);
}

@media (max-width: 420px){
  .card__icon{ width: 84px; height: 84px; }
  .card--icon .card__body{ padding-right: calc(var(--space-4) + 92px); }
}


/* ------------------------------
   Utility: Corner icons (used on cards, library sections, etc.)
   ------------------------------ */
.tf-has-corner-icon{
  position: relative;
}
.tf-corner-icon{
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 100px;
  height: 100px;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  z-index: 2;
}
.tf-has-corner-icon > :where(h1,h2,h3,h4,h5,h6,p,ul,ol,div){
  /* Reserve space so content doesn't run under the icon */
  max-width: calc(100% - 110px);
}
@media (max-width: 420px){
  .tf-corner-icon{ width: 84px; height: 84px; }
  .tf-has-corner-icon > :where(h1,h2,h3,h4,h5,h6,p,ul,ol,div){
    max-width: calc(100% - 92px);
  }
}
.card__body{ padding: var(--space-4); }
.card__title{ margin:0; font-size: 1.15rem; letter-spacing: -0.01em; }
.card__text{ margin:0; color: var(--tf-muted); }
.card__meta{ display:flex; flex-wrap:wrap; gap: var(--space-2); margin-top: var(--space-3); }
.card__actions{
  padding: var(--space-4);
  padding-top: 0;
  display:flex;
  align-items:center;
  justify-content:flex-start;
}
.card--comingSoon{
  background: linear-gradient(180deg, var(--tf-bg), var(--tf-surface));
}

.notice{
  border: 1px dashed var(--tf-border);
  border-radius: 14px;
  padding: var(--space-4);
  background: var(--tf-bg);
  color: var(--tf-muted);
}

/* ------------------------------
   Forms (scoped)
   ------------------------------ */
.tf-form{
  border: 1px solid var(--tf-border);
  background: var(--tf-bg);
  border-radius: 16px;
  padding: var(--space-5);
  box-shadow: 0 10px 22px rgba(16,18,20,0.05);
}

.tf-form .tf-form__hint{
  margin: 0;
  color: var(--tf-muted);
}

.tf-form .tf-field{
  display: grid;
  gap: 6px;
  margin-top: var(--space-3);
}

.tf-form .tf-field label{
  font-weight: 600;
}

.tf-form input[type="text"],
.tf-form input[type="email"],
.tf-form textarea{
  width: 100%;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--tf-border);
  background: var(--tf-surface);
  color: var(--tf-text);
  font: inherit;
}

.tf-form textarea{
  min-height: 170px;
  resize: vertical;
}

.tf-form input::placeholder,
.tf-form textarea::placeholder{
  color: color-mix(in srgb, var(--tf-muted), transparent 25%);
}

.tf-form input:focus,
.tf-form textarea:focus{
  outline: none;
  border-color: color-mix(in srgb, var(--tf-accent), var(--tf-border) 35%);
  box-shadow: 0 0 0 3px rgba(31,115,183,0.20);
}

.tf-form .tf-actions{
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  align-items: center;
  margin-top: var(--space-4);
}

.tf-form .tf-actions .tf-actions__note{
  color: var(--tf-muted);
  font-size: 0.95rem;
}

.notice.notice--success{
  border-style: solid;
  background: color-mix(in srgb, #16a34a, var(--tf-bg) 92%);
  color: #0b3d1a;
}

.notice.notice--error{
  border-style: solid;
  background: color-mix(in srgb, #dc2626, var(--tf-bg) 92%);
  color: #4a0b0b;
}

/* Wider layout: label + control columns */
@media (min-width: 720px){
  .tf-form .tf-field{
    grid-template-columns: 160px 1fr;
    align-items: center;
    gap: 10px;
  }
  .tf-form .tf-field label{
    margin-top: 2px;
  }
  .tf-form .tf-field .tf-control{
    width: 100%;
  }
}

/* ------------------------------
   Resources (Knowledge Library / Recommended Aids / Infographics)
   Neutral, content-first styling (NOT home card styling)
   ------------------------------ */
.tf-res-page{
  padding: var(--space-6) 0;
}
.tf-res-wrap{
  max-width: 1480px;
  margin: 0 auto;
  padding: 0 var(--space-5);
}
@media (max-width: 720px){
  .tf-res-wrap{ padding: 0 var(--space-4); }
}

.tf-res-hero h1{ margin: 0 0 var(--space-2); letter-spacing: -0.02em; }
.tf-res-hero p{ margin: 0; color: var(--tf-muted); max-width: 78ch; }

.tf-res-toolbar{ margin-top: var(--space-4); display:grid; gap: var(--space-3); }

.tf-res-search{
  display:flex;
  align-items:center;
  gap: .6rem;
  border: 1px solid var(--tf-border);
  background: var(--tf-bg);
  border-radius: 12px;
  padding: .65rem .8rem;
  max-width: 720px;
}
.tf-res-search input{
  border: 0;
  outline: none;
  background: transparent;
  width: 100%;
  color: var(--tf-text);
  font-size: 1rem;
}
.tf-res-search input::placeholder{ color: color-mix(in srgb, var(--tf-muted), transparent 25%); }

.tf-res-chiprow{
  display:flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items:center;
}
.tf-res-chip{
  appearance:none;
  border: 1px solid var(--tf-border);
  background: var(--tf-surface);
  color: var(--tf-muted);
  border-radius: 999px;
  padding: .28rem .7rem;
  font-size: .9rem;
  line-height: 1.1;
  cursor: pointer;
  user-select: none;
}
.tf-res-chip[aria-pressed="true"]{
  background: var(--tf-text);
  color: var(--tf-bg);
  border-color: color-mix(in srgb, var(--tf-text), transparent 35%);
}
.tf-res-chip:focus-visible{ box-shadow: 0 0 0 3px rgba(31,115,183,0.35); }

/* ------------------------------
   Infographics grid + cards
   ------------------------------ */
.tf-ig-grid{
  margin-top: var(--space-5);
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-5);
}

.tf-ig-card{
  border: 1px solid var(--tf-border);
  background: var(--tf-bg);
  border-radius: 16px;
  overflow:hidden;
  box-shadow: 0 10px 22px rgba(16,18,20,0.05);
  display:flex;
  flex-direction: column;
  min-height: 100%;
}

.tf-ig-thumb{
  display:block;
  background: var(--tf-surface);
  border-bottom: 1px solid var(--tf-border);
}
.tf-ig-thumb img{
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  display:block;
}

.tf-ig-body{ padding: var(--space-4); display:flex; flex-direction:column; gap: var(--space-3); }
.tf-ig-title{ margin: 0; font-size: 1.1rem; letter-spacing: -0.01em; }
.tf-ig-title a{ color: #1f73b7; text-decoration:none; }
.tf-ig-title a:hover{ text-decoration: underline; }
.tf-ig-desc{ margin: 0; color: var(--tf-muted); }
.tf-ig-meta{ display:flex; flex-wrap:wrap; gap: var(--space-2); }
.tf-ig-actions{ display:flex; gap: var(--space-2); align-items:center; margin-top: auto; }

.tf-ig-empty{
  margin-top: var(--space-5);
  border: 1px dashed var(--tf-border);
  border-radius: 14px;
  padding: var(--space-4);
  background: var(--tf-bg);
  color: var(--tf-muted);
}

/* ------------------------------
   Infographics modal (fixed overlay)
   ------------------------------ */
.tf-ig-modal{
  position: fixed;
  inset: 0;
  display:none;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  background: rgba(0,0,0,0.55);
  z-index: 9999;
}
.tf-ig-modal[aria-hidden="false"]{ display:flex; }

.tf-ig-modal__panel{
  width: min(1100px, 100%);
  max-height: min(86vh, 920px);
  background: var(--tf-bg);
  border: 1px solid var(--tf-border);
  border-radius: 16px;
  overflow:hidden;
  box-shadow: 0 18px 55px rgba(0,0,0,0.28);
  display:flex;
  flex-direction: column;
}

.tf-ig-modal__bar{
  padding: var(--space-4);
  border-bottom: 1px solid var(--tf-border);
  background: var(--tf-surface);
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: var(--space-3);
}
.tf-ig-modal__bar h2{ margin:0; font-size: 1.15rem; }

.tf-ig-modal__img{
  padding: var(--space-4);
  overflow:auto;
}
.tf-ig-modal__img img{
  width: 100%;
  height: auto;
  display:block;
  border: 1px solid var(--tf-border);
  border-radius: 12px;
  background: var(--tf-surface);
}

@media (max-width: 720px){
  .tf-ig-modal{ padding: var(--space-4); }
  .tf-ig-modal__panel{ max-height: 90vh; }
  .tf-ig-modal__bar{ flex-direction: column; align-items:flex-start; }
}

/* ------------------------------
   Ads: Footer leaderboard slot
   ------------------------------ */
.site-footer__ad{
  padding-top: var(--space-4);
  padding-bottom: var(--space-2);
}
.ad-slot{
  width:100%;
  min-height: 90px; /* leaderboard height */
  border: 1px solid var(--tf-border);
  background: var(--tf-bg);
  border-radius: 12px;
  display:flex;
  align-items:center;
  justify-content:center;
  color: var(--tf-muted);
  font-size: 0.85rem;
}
@media (max-width: 420px){
  .ad-slot{ min-height: 60px; } /* small screens often serve smaller formats */
}
