/*
 * EN Google Ad Grants guide (views/pages/redesign/guide.ejs).
 * Values from Paper "Guide · Google Ad Grants (desktop)" (1440), "(mobile 390)"
 * and "Guide · Contents open (mobile state)". Desktop rules first; the
 * two-column layout needs 1100px; the mobile board below 768px.
 * The final ask lives in ../ask.css.
 */

.g-head, .g-body { --g-pad: clamp(24px, 8.333vw, 120px); }

/* ── Header (dark) ───────────────────────────────────────────────────── */
.g-head { position: relative; background: var(--ink); color: var(--paper); overflow: clip; }
.g-head__inner {
  position: relative;
  max-width: var(--container);
  margin-inline: auto;
  /* Paper: 24px top + 58px nav pill + 96px gap; the nav is fixed above it */
  padding: 178px var(--g-pad) 88px;
}
.g-head__copy { display: flex; flex-direction: column; gap: 28px; max-width: 900px; }
.g-head__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; color: var(--muted-on-ink); font-size: 15px; line-height: 20px; }
.g-chip {
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: rgb(22 190 121 / 0.15);
  color: var(--emerald);
  font-size: 14px;
  font-weight: 600;
  line-height: 18px;
}
.g-head__title {
  font-family: var(--font-display);
  font-size: clamp(46px, 31.89px + 3.619vw, 84px); /* 84 / 46 */
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 0.976; /* 82 / 84 */
}
.g-head__sub { max-width: 720px; color: var(--text-on-ink); font-size: clamp(18px, 16.86px + 0.29vw, 22px); line-height: 1.5; }
.g-head__byline { color: var(--muted-on-ink); font-size: 14px; line-height: 20px; }

/* Search box motif, tilted, top right (desktop only) */
.g-search {
  position: absolute;
  top: 236px;
  right: var(--g-pad);
  display: flex;
  align-items: center;
  gap: 14px;
  width: 400px;
  padding: 16px 24px;
  border: 2px solid var(--emerald);
  border-radius: var(--radius-pill);
  background: rgb(246 248 244 / 0.06);
  color: var(--paper);
  font-size: 20px;
  line-height: 26px;
  transform: rotate(-3deg);
  transform-origin: 0 0;
}
.g-search svg { flex-shrink: 0; color: var(--emerald); }
.g-search__caret { color: var(--emerald); margin-left: 1px; }
@media (prefers-reduced-motion: no-preference) {
  .g-search__caret { animation: g-caret 1.1s steps(1) infinite; }
}
@keyframes g-caret { 50% { opacity: 0; } }
@media (max-width: 1199px) { .g-search { display: none; } }

/* ── Body: contents column + article ─────────────────────────────────── */
.g-body {
  display: flex;
  align-items: flex-start;
  gap: clamp(40px, 6.944vw, 100px);
  max-width: var(--container);
  margin-inline: auto;
  padding: 88px var(--g-pad) 120px;
}
.g-article {
  flex: 0 1 680px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 56px;
}

/* Section anchors land below the fixed nav (and the contents bar on mobile) */
.g-article [id] { scroll-margin-top: 112px; }

/* ── Contents ────────────────────────────────────────────────────────── */
.toc {
  position: sticky;
  top: 112px;
  flex: 0 0 260px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  z-index: 2;
}
.toc__bar { display: none; }
.toc__panel { display: flex; flex-direction: column; gap: 20px; }
.toc__label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 16px;
  text-transform: uppercase;
}
.toc__list { border-left: 2px solid var(--line); }
.toc__link {
  display: block;
  margin-left: -2px;
  padding: 9px 0 9px 16px;
  border-left: 4px solid transparent;
  color: var(--muted);
  font-size: 16px;
  line-height: 22px;
  text-decoration: none;
  transition: color var(--dur-hover) ease, border-color var(--dur-hover) ease;
}
.toc__link[aria-current='true'] { border-left-color: var(--emerald); color: var(--ink); font-weight: 600; }
@media (hover: hover) and (pointer: fine) {
  .toc__link:hover { color: var(--ink); }
}
.toc__ask {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--text-2);
  font-size: 15px;
  line-height: 22px;
}
.toc__btn { font-size: 15px; }

/* ── Article type ────────────────────────────────────────────────────── */
.g-article { color: var(--text-article); }
.g-article h2, .g-article h3 { color: var(--ink); }
.g-article strong { color: var(--ink); font-weight: 600; }
.g-sec { display: flex; flex-direction: column; gap: 22px; }
.g-sec > p, .g-bullets p, .steps-v__body > p:last-child, .mistakes p { font-size: 19px; line-height: 32px; }
.g-sec__num { color: var(--deep-green); font-size: 14px; font-weight: 600; letter-spacing: 0.06em; line-height: 18px; }
.g-sec__title { font-family: var(--font-display); font-size: clamp(32px, 28.29px + 0.952vw, 42px); font-weight: 800; letter-spacing: -0.025em; line-height: 1.095; }
.g-sec__sub { padding-top: 12px; font-family: var(--font-display); font-size: clamp(22px, 20.51px + 0.381vw, 26px); font-weight: 700; letter-spacing: -0.01em; line-height: 32px; }
.src { color: var(--deep-green); font-size: 14px; font-weight: 500; }
.g-article a:not(.btn):not(.path__link) { color: var(--deep-green); text-decoration: underline 1px; text-underline-offset: 2px; }

/* The short version */
.g-short { display: flex; flex-direction: column; gap: 24px; padding: 40px 44px; border-radius: var(--radius-tile); background: var(--paper-2); }
.g-short__title { font-family: var(--font-display); font-size: 30px; font-weight: 800; letter-spacing: -0.02em; line-height: 34px; }
.g-short__list { display: flex; flex-direction: column; gap: 18px; }
.g-short__list li { display: flex; gap: 16px; }
.g-short__n { width: 28px; flex-shrink: 0; color: var(--deep-green); font-family: var(--font-display); font-size: 18px; font-weight: 800; line-height: 30px; }
.g-short__list p { font-size: 18px; line-height: 30px; }

/* Callouts */
.callout { display: flex; gap: 18px; padding: 24px 28px; border-radius: 20px; }
.callout svg { flex-shrink: 0; }
.callout > div { display: flex; flex-direction: column; gap: 6px; }
.callout__label { font-size: 14px; font-weight: 700; letter-spacing: 0.06em; line-height: 18px; text-transform: uppercase; }
.callout__text { font-size: 18px; line-height: 29px; }
.callout--tip { background: var(--mint-3); color: var(--deep-green); }
.callout--tip .callout__label { color: var(--deep-green); }
.callout--tip .callout__text { color: var(--text-tip); }
.callout--warn { background: var(--ink); color: var(--emerald); }
.callout--warn .callout__label { color: var(--emerald); }
.callout--warn .callout__text { color: var(--text-on-ink-2); }

/* Bullets */
.g-bullets { display: flex; flex-direction: column; gap: 14px; }
.g-bullets li { position: relative; padding-left: 34px; }
.g-bullets li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 13px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--emerald);
}

/* Rules checklist */
.rules { display: flex; flex-direction: column; padding: 12px 28px; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--white); }
.rules__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 16px; border-bottom: 1px solid var(--line); }
.rules__title { flex-shrink: 0; font-family: var(--font-display); font-size: 20px; font-weight: 700; line-height: 26px; }
.rules__src { color: var(--deep-green); font-size: 13px; font-weight: 500; line-height: 18px; text-align: right; }
.rules__list li { display: flex; gap: 14px; padding-block: 16px; border-bottom: 1px solid var(--paper-2); }
.rules__list li:last-child { border-bottom: 0; }
.rules__tick { flex-shrink: 0; margin: 4px 4px 0 0; color: var(--emerald); }
.rules__list p { font-size: 18px; line-height: 28px; }

/* Mid-article ask */
.mid-ask {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 20px;
  padding: 40px 44px;
  border-radius: var(--radius-tile);
  background: var(--emerald);
  color: var(--ink);
  overflow: clip;
}
.mid-ask :focus-visible { outline-color: var(--ink); }
.mid-ask__title { position: relative; z-index: 1; max-width: 520px; font-family: var(--font-display); font-size: 34px; font-weight: 800; letter-spacing: -0.02em; line-height: 38px; }
.mid-ask__text { position: relative; z-index: 1; max-width: 500px; color: var(--ink); font-size: 18px; line-height: 28px; }
.mid-ask__btn { position: relative; z-index: 1; padding: 16px 26px; font-size: 17px; line-height: 22px; }
.mid-ask__ring {
  position: absolute;
  top: -70px;
  right: -60px;
  width: 260px;
  height: 260px;
  border: 28px solid rgb(10 106 68 / 0.2);
  border-radius: 50%;
  pointer-events: none;
}

/* Steps (vertical timeline) */
.steps-v { display: flex; flex-direction: column; padding-top: 8px; }
.steps-v__item { display: flex; gap: 22px; }
.steps-v__rail { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; width: 44px; }
.steps-v__rail::after { content: ''; flex-grow: 1; width: 2px; background: var(--line); }
.steps-v__item--last .steps-v__rail::after { background: none; }
.steps-v__n {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--emerald);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  line-height: 22px;
}
.steps-v__item--last .steps-v__n { background: var(--emerald); color: var(--ink); }
.steps-v__body { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 8px; padding: 8px 0 36px; }
.steps-v__item--last .steps-v__body { padding-bottom: 0; }
.steps-v__title { font-family: var(--font-display); font-size: 24px; font-weight: 700; line-height: 30px; }
.steps-v__meta { color: var(--muted); font-size: 14px; font-weight: 600; line-height: 18px; }

/* Six mistakes */
.mistakes { border-top: 1px solid var(--line); }
.mistakes li { display: flex; gap: 24px; padding-block: 28px; border-bottom: 1px solid var(--line); }
.mistakes__n { width: 56px; flex-shrink: 0; color: var(--emerald); font-family: var(--font-display); font-size: 44px; font-weight: 800; letter-spacing: -0.03em; line-height: 44px; }
.mistakes li > div { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.mistakes__title { font-family: var(--font-display); font-size: 24px; font-weight: 700; line-height: 30px; }
.fix { color: var(--deep-green); font-weight: 600; }

/* Three campaign kinds */
.kinds { display: flex; gap: 12px; }
.kinds li { flex: 1 1 0; display: flex; flex-direction: column; gap: 8px; padding: 22px; border-radius: 20px; background: var(--paper-2); }
.kinds__title { font-family: var(--font-display); font-size: 20px; font-weight: 700; line-height: 26px; }
.kinds p { color: var(--text-2); font-size: 16px; line-height: 24px; }

/* Two paths */
.paths { display: flex; gap: 12px; }
.path { flex: 1 1 0; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 24px; border: 1px solid var(--line); border-radius: 20px; background: var(--white); }
.path--ours { border: 2px solid var(--emerald); padding: 23px; }
.path__title { font-family: var(--font-display); font-size: 22px; font-weight: 700; line-height: 28px; }
.path p { color: var(--text-2); font-size: 17px; line-height: 27px; }
.g-article .path__link {
  display: inline-block;
  padding-block: 11px;
  margin-block: -11px;
  color: var(--deep-green);
  font-size: 16px;
  font-weight: 600;
  line-height: 22px;
  text-decoration: none;
}
.path__link span { display: inline-block; transition: transform var(--dur-hover) var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .g-article .path__link:hover { text-decoration: underline 1px; text-underline-offset: 2px; }
  .path__link:hover span { transform: translateX(4px); }
}

/* FAQ (base.css accordion, Paper sizes) */
.g-faq .faq__q { font-size: 22px; line-height: 28px; gap: 16px; }
.g-faq .faq__a { max-width: none; }
.g-faq .faq__a-inner { color: var(--text-2); font-size: 18px; line-height: 29px; }

/* Author */
.g-author { display: flex; align-items: center; gap: 20px; padding-top: 28px; border-top: 1px solid var(--line); }
.g-author__img { flex-shrink: 0; width: 72px; height: 72px; border-radius: 50%; object-fit: cover; }
.g-author__text { display: flex; flex-direction: column; gap: 4px; }
.g-author__name { color: var(--ink); font-family: var(--font-display); font-size: 19px; font-weight: 700; line-height: 24px; }
.g-author__bio { color: var(--muted); font-size: 16px; line-height: 24px; }

/* ══ Below 1100px: one column, contents become a sticky bar ══════════ */
@media (max-width: 1099px) {
  .g-body { flex-direction: column; align-items: stretch; gap: 32px; }
  .g-article { flex: none; width: 100%; max-width: 680px; }
  .g-article [id] { scroll-margin-top: 150px; }

  .toc { top: 72px; flex: none; width: 100%; max-width: 680px; }
  .toc__ask { display: none; }
  .toc__card { position: relative; }
  .toc__bar {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 44px;
    padding: 14px 18px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--white);
    color: var(--ink);
    text-align: left;
  }
  .toc__icon { flex-shrink: 0; color: var(--deep-green); }
  .toc__chev { flex-shrink: 0; margin-left: auto; transition: transform var(--dur-hover) var(--ease-out); }
  .toc__bar-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
  .toc__bar-label, .toc__bar-open {
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.06em;
    line-height: 16px;
    text-transform: uppercase;
  }
  .toc__bar-current { overflow: hidden; color: var(--ink); font-size: 16px; font-weight: 600; line-height: 20px; text-overflow: ellipsis; white-space: nowrap; }
  .toc__bar-open { display: none; }
  .toc__bar[aria-expanded='true'] { border-color: var(--line); border-bottom-color: var(--paper-2); border-radius: 16px 16px 0 0; box-shadow: 0 12px 32px rgb(14 27 22 / 0.12); }
  .toc__bar[aria-expanded='true'] .toc__icon,
  .toc__bar[aria-expanded='true'] .toc__bar-text { display: none; }
  .toc__bar[aria-expanded='true'] .toc__bar-open { display: block; }
  .toc__bar[aria-expanded='true'] .toc__chev { transform: rotate(180deg); }

  .toc__label { display: none; }
  .toc__panel {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    gap: 0;
    max-height: calc(100dvh - 160px);
    overflow-y: auto;
    padding-block: 8px;
    border: 1px solid var(--line);
    border-top: 0;
    border-radius: 0 0 16px 16px;
    background: var(--white);
    box-shadow: 0 12px 32px rgb(14 27 22 / 0.12);
  }
  .js .toc__panel:not(.is-open) { display: none; }
  .toc__list { border-left: 0; }
  .toc__link { margin-left: 0; padding: 12px 18px; border-left: 0; color: var(--text-2); font-size: 17px; }
  .toc__link[aria-current='true'] { padding-left: 14px; border-left: 4px solid var(--emerald); background: var(--mint-3); color: var(--ink); }
  /* Without JS the list is simply open, in the page flow */
  html:not(.js) .toc__panel { position: static; border-top: 1px solid var(--line); border-radius: 16px; box-shadow: none; margin-top: 8px; max-height: none; }
  html:not(.js) .toc__bar { pointer-events: none; }
  html:not(.js) .toc__chev { display: none; }
}

/* ══ Mobile board (390) ═══════════════════════════════════════════════ */
@media (max-width: 767px) {
  .g-head__inner { padding: 114px 16px 48px; }
  .g-head__copy { gap: 20px; }
  .g-head__meta { gap: 10px; font-size: 14px; line-height: 18px; }
  .g-chip { padding: 5px 12px; font-size: 13px; line-height: 16px; }
  .g-head__title { line-height: 1; }
  .g-head__sub { line-height: 28px; }

  .g-body { gap: 0; padding: 12px 0 0; }
  .toc { padding-inline: 16px; }
  .g-article { gap: 48px; padding: 32px 20px 64px; }

  .g-sec > p, .g-bullets p, .steps-v__body > p:last-child, .mistakes p { font-size: 18px; line-height: 30px; }
  .g-sec__title { line-height: 36px; }
  .g-sec__sub { line-height: 28px; }

  .g-short { gap: 24px; padding: 28px 22px; border-radius: 22px; }
  .g-short__title { font-size: 26px; line-height: 30px; }
  .g-short__list { gap: 16px; }
  .g-short__n { width: 20px; }
  .g-short__list p { font-size: 17px; line-height: 28px; }

  .callout { gap: 14px; padding: 20px; }
  .callout__text { font-size: 17px; line-height: 28px; }

  .rules { padding: 8px 20px; }
  .rules__head { flex-direction: column; align-items: flex-start; gap: 4px; }
  .rules__src { text-align: left; }
  .rules__list p { font-size: 17px; line-height: 27px; }

  .mid-ask { gap: 16px; padding: 32px 24px; border-radius: var(--radius-card); }
  .mid-ask__title { font-size: 28px; line-height: 32px; }
  .mid-ask__text { font-size: 17px; line-height: 27px; }

  .steps-v__item { gap: 14px; }
  .steps-v__rail { width: 36px; }
  .steps-v__n { width: 36px; height: 36px; }
  .steps-v__title { font-size: 20px; line-height: 26px; }

  .mistakes li { gap: 14px; padding-block: 24px; }
  .mistakes__n { width: 32px; font-size: 34px; line-height: 34px; }
  .mistakes__title { font-size: 20px; line-height: 26px; }

  .kinds, .paths { flex-direction: column; }

  .g-faq .faq__q { font-size: 19px; line-height: 25px; }
  .g-faq .faq__a-inner { font-size: 17px; line-height: 28px; }

  .g-author { align-items: flex-start; }
  .g-author__img { width: 56px; height: 56px; }
}
