/* ==========================================================================
   Hawthorne CPA & Advisors — site.css
   Site-wide foundations: fonts, design tokens, reset, typography, layout,
   buttons, form controls, cards, header, footer, accessibility helpers.

   Page-specific styles live in their own stylesheet (e.g. css/home.css).

   Breakpoints used throughout this project:
     640px   small  — service grid goes 2-up, footer becomes a row
     900px   medium — three-column step layout
     1024px  large  — full desktop: split hero, split relationship section
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Fonts (self-hosted, latin subset)
   Instrument Sans ships as a single variable file covering 400–700.
   -------------------------------------------------------------------------- */

@font-face {
  font-family: "Instrument Sans";
  src: url("../assets/fonts/instrument-sans-latin-var.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Newsreader";
  src: url("../assets/fonts/newsreader-latin-var.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* --------------------------------------------------------------------------
   2. Design tokens
   -------------------------------------------------------------------------- */

:root {
  /* Brand colours — official Hawthorne blue */
  --color-brand: #1c61ec;
  --color-brand-dark: #104bc2;
  --color-ink: #212223;
  --color-body: #4a5769;
  --color-muted: #6b7688;
  --color-surface: #ffffff;
  --color-tint: #eef3fb;
  --color-hairline: rgba(33, 34, 35, 0.1);

  /* On a brand-blue background */
  --color-on-brand: #ffffff;
  --color-on-brand-muted: rgba(255, 255, 255, 0.9);
  --color-on-brand-line: rgba(255, 255, 255, 0.28);
  --color-on-brand-line-strong: rgba(255, 255, 255, 0.42);
  --color-on-brand-surface: rgba(255, 255, 255, 0.05);

  /* Typefaces */
  --font-serif: "Newsreader", Georgia, "Times New Roman", serif;
  --font-sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Fluid type scale — interpolates between the approved 390px mobile
     and 1280px desktop designs. */
  --text-display: clamp(2.5rem, 1.788rem + 2.921vw, 4.125rem);   /* 40 → 66 */
  --text-h2: clamp(1.875rem, 1.546rem + 1.348vw, 2.625rem);      /* 30 → 42 */
  --text-h2-sm: clamp(1.8125rem, 1.594rem + 0.899vw, 2.3125rem); /* 29 → 37 */
  --text-h3: 1.1875rem;                                          /* 19       */
  --text-lead: clamp(1.03125rem, 0.99rem + 0.169vw, 1.125rem);   /* 16.5 → 18 */
  --text-body: clamp(1rem, 0.986rem + 0.056vw, 1.03125rem);      /* 16 → 16.5 */
  --text-small: clamp(0.9375rem, 0.924rem + 0.056vw, 0.96875rem);/* 15 → 15.5 */
  --text-name: clamp(0.875rem, 0.848rem + 0.112vw, 0.9375rem);   /* 14 → 15  */
  --text-button: 0.78125rem;                                     /* 12.5     */
  --text-meta: 0.78125rem;                                       /* 12.5     */

  /* Spacing */
  --gutter: clamp(1.25rem, 0.264rem + 4.045vw, 3.5rem);          /* 20 → 56 */
  --section-y: clamp(3.5rem, 2.02rem + 6.07vw, 6.5rem);          /* 56 → 104 */
  --gap-grid: clamp(1.125rem, 0.317rem + 2.022vw, 2rem);         /* 18 → 32 */
  --container-max: 1280px;

  /* Shape */
  --radius-card: 14px;
  --radius-media: 10px;
  --radius-photo: 8px;
  --radius-control: 6px;
  --radius-pill: 999px;

  --shadow-card: 0 22px 48px rgba(33, 34, 35, 0.16);

  --transition-lift: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1),
    box-shadow 0.35s ease;
}

/* --------------------------------------------------------------------------
   3. Reset
   -------------------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--color-surface);
  color: var(--color-body);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4,
p,
figure,
blockquote {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

img,
svg {
  display: block;
  max-width: 100%;
  /* width/height attributes are present on every image to reserve layout
     space; height:auto lets CSS drive the rendered size from the ratio. */
  height: auto;
}

a {
  color: var(--color-brand);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--color-brand-dark);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

/* The hidden attribute must win over component display rules. */
[hidden] {
  display: none !important;
}

/* --------------------------------------------------------------------------
   4. Typography
   -------------------------------------------------------------------------- */

.heading-display,
.heading-1,
.heading-2,
.heading-3 {
  font-family: var(--font-serif);
  font-weight: 400;
  color: var(--color-ink);
  text-wrap: pretty;
}

.heading-display {
  font-size: var(--text-display);
  line-height: 1.06;
  letter-spacing: -0.02em;
}

.heading-1 {
  font-size: var(--text-h2);
  line-height: 1.12;
}

.heading-2 {
  font-size: var(--text-h2-sm);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.heading-3 {
  font-size: var(--text-h3);
  line-height: 1.3;
}

.lead {
  font-size: var(--text-lead);
  line-height: 1.62;
  color: var(--color-body);
  text-wrap: pretty;
}

.prose p {
  font-size: var(--text-body);
  line-height: 1.74;
  color: var(--color-body);
  /* Left-aligned at every screen size — an intentional readability
     improvement over the justified text in the design export. */
  text-align: left;
}

.prose p + p {
  margin-top: 1.125rem;
}

/* Short accent rule that opens a section */
.rule {
  display: block;
  width: clamp(2.75rem, 2.2rem + 1.35vw, 3.5rem); /* 44 → 56 */
  height: 3px;
  background: var(--color-brand);
  border: 0;
}

/* --------------------------------------------------------------------------
   5. Layout
   -------------------------------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  padding-block: var(--section-y);
}

.section--tint {
  background: var(--color-tint);
}

.section--brand {
  background: var(--color-brand);
}

/* --------------------------------------------------------------------------
   6. Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 54px;
  padding: 1rem 2.5rem;
  border: 0;
  border-radius: 0;
  font-family: var(--font-sans);
  font-size: var(--text-button);
  font-weight: 600;
  letter-spacing: 0.2em;
  line-height: 1;
  text-transform: uppercase;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Solid brand button */
.btn--primary {
  background: var(--color-brand);
  color: var(--color-on-brand);
}

.btn--primary:hover {
  background: var(--color-brand-dark);
  color: var(--color-on-brand);
}

/* White button, used on a brand-blue background */
.btn--inverse {
  background: var(--color-surface);
  color: var(--color-brand);
  font-weight: 700;
  min-height: 56px;
}

.btn--inverse:hover {
  background: var(--color-ink);
  color: var(--color-surface);
}

/* Quiet outlined button, used for Back / secondary navigation */
.btn--secondary {
  background: var(--color-surface);
  color: var(--color-ink);
  border: 1px solid rgba(33, 34, 35, 0.28);
}

.btn--secondary:hover {
  background: var(--color-tint);
  border-color: var(--color-brand);
  color: var(--color-brand);
}

.btn--pill {
  border-radius: var(--radius-pill);
}

.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Buttons run full width on small screens and shrink to their content
   from the small breakpoint up, matching the approved designs. */
@media (min-width: 640px) {
  .btn {
    display: inline-flex;
    width: auto;
  }

  .btn--primary {
    padding: 1.125rem 2.5rem;
  }

  .btn--inverse {
    padding: 1.5rem 3.625rem;
  }
}

/* --------------------------------------------------------------------------
   7. Form controls (foundation for the Get Started page)
   -------------------------------------------------------------------------- */

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

.field + .field {
  margin-top: 1.25rem;
}

.field__label {
  display: block;
  margin-bottom: 0.4375rem;
  font-size: var(--text-name);
  font-weight: 600;
  color: var(--color-ink);
}

.field__hint {
  display: block;
  margin-bottom: 0.5rem;
  font-size: var(--text-meta);
  color: var(--color-muted);
}

.field__control {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 0.75rem 0.875rem;
  background: var(--color-surface);
  border: 1px solid rgba(33, 34, 35, 0.22);
  border-radius: var(--radius-control);
  font-size: var(--text-body);
  color: var(--color-ink);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field__control:hover {
  border-color: rgba(33, 34, 35, 0.4);
}

.field__control:focus {
  border-color: var(--color-brand);
  box-shadow: 0 0 0 3px rgba(28, 97, 236, 0.18);
  outline: none;
}

textarea.field__control {
  min-height: 8rem;
  line-height: 1.6;
  resize: vertical;
}

.field__error {
  display: block;
  margin-top: 0.4375rem;
  font-size: var(--text-meta);
  font-weight: 500;
  color: #b3261e;
}

.field--invalid .field__control {
  border-color: #b3261e;
}

/* Fieldset legends read as labels */
legend.field__label {
  padding: 0;
}

.field__optional {
  font-weight: 400;
  color: var(--color-muted);
}

/* Radio / checkbox choices, styled as selectable rows.
   The native control stays visible so keyboard and screen-reader
   behaviour is entirely standard. */
.choice-group {
  display: grid;
  gap: 0.625rem;
}

@media (min-width: 640px) {
  .choice-group--split {
    grid-template-columns: 1fr 1fr;
  }
}

.choice {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 52px;
  padding: 0.75rem 1rem;
  background: var(--color-surface);
  border: 1px solid rgba(33, 34, 35, 0.22);
  border-radius: var(--radius-control);
  font-size: var(--text-body);
  color: var(--color-ink);
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.choice:hover {
  border-color: rgba(33, 34, 35, 0.45);
}

.choice__input {
  flex: none;
  width: 1.125rem;
  height: 1.125rem;
  margin: 0;
  accent-color: var(--color-brand);
}

.choice:has(.choice__input:checked) {
  border-color: var(--color-brand);
  background: var(--color-tint);
  box-shadow: inset 0 0 0 1px var(--color-brand);
}

.field--invalid .choice {
  border-color: #b3261e;
}

/* Honeypot: present for spam filtering, hidden from people and
   assistive technology alike. */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   8. Service cards

   In Phase 1 the panels are static (there are no service pages to link to
   yet), so they render as plain elements with no hover affordance. When the
   markup wrapper becomes an <a>, the lift and shadow below activate on their
   own — no other change required.
   -------------------------------------------------------------------------- */

.service-card {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: var(--color-surface);
  border-radius: var(--radius-card);
}

.service-card__media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-media);
}

/* Two of the four artworks bleed to the edge of the image rather than
   carrying their own margin, so they get a small inset to match the set. */
.service-card--inset {
  padding: 2.4%;
}

a.service-card {
  text-decoration: none;
  transition: var(--transition-lift);
}

a.service-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-card);
}

/* --------------------------------------------------------------------------
   9. Site header
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-hairline);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: clamp(1rem, 0.65rem + 1.35vw, 1.5rem); /* 16 → 24 */
}

.site-header__home {
  display: inline-flex;
  align-items: center;
  padding-block: 0.375rem; /* keeps the tap target comfortable */
}

.site-header__logo {
  height: clamp(1.625rem, 1.46rem + 0.674vw, 2rem); /* 26 → 32 */
  width: auto;
}

@media (min-width: 1024px) {
  /* The approved desktop design does not pin the header. */
  .site-header {
    position: static;
  }
}

/* --------------------------------------------------------------------------
   10. Site footer
   -------------------------------------------------------------------------- */

.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-hairline);
}

.site-footer__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.625rem;
  padding-block: clamp(2.125rem, 1.6rem + 2.02vw, 2.75rem); /* 34 → 44 */
  text-align: center;
}

.site-footer__home {
  display: inline-flex;
  align-items: center;
  padding-block: 0.375rem;
}

.site-footer__logo {
  height: 1.5rem; /* 24 */
  width: auto;
}

.site-footer__contact {
  font-size: var(--text-meta);
  line-height: 1.7;
  color: var(--color-muted);
}

.site-footer__phone {
  display: block;
  font-size: 0.875rem; /* 14 */
  font-weight: 600;
  color: var(--color-ink);
  text-decoration: none;
}

.site-footer__phone:hover {
  color: var(--color-brand);
  text-decoration: underline;
}

@media (min-width: 640px) {
  .site-footer__inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    text-align: left;
  }

  .site-footer__contact {
    text-align: right;
  }

  .site-footer__phone {
    font-size: var(--text-meta);
    font-weight: 400;
    color: inherit;
  }
}

/* --------------------------------------------------------------------------
   11. Accessibility helpers
   -------------------------------------------------------------------------- */

/* Visible to screen readers and search engines, hidden on screen. Used for
   service names that appear visually inside the panel artwork. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: 0;
  z-index: 100;
  transform: translateY(-150%);
  padding: 0.75rem 1.25rem;
  background: var(--color-brand);
  color: var(--color-on-brand);
  font-size: var(--text-name);
  font-weight: 600;
  text-decoration: none;
  border-radius: 0 0 var(--radius-control) var(--radius-control);
  transition: transform 0.15s ease;
}

.skip-link:focus {
  transform: translateY(0);
  color: var(--color-on-brand);
}

/* Visible keyboard focus everywhere */
:focus-visible {
  outline: 3px solid var(--color-brand);
  outline-offset: 3px;
  border-radius: 2px;
}

/* On brand-blue backgrounds the blue ring would disappear */
.section--brand :focus-visible,
.hero__panel :focus-visible {
  outline-color: var(--color-on-brand);
}

/* --------------------------------------------------------------------------
   12. Page message
   A centred single-message layout. Used by the 404 page, and available for
   the Get Started confirmation state.
   -------------------------------------------------------------------------- */

.page-message {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-height: 52vh;
  padding-block: var(--section-y);
}

.page-message__rule {
  margin-bottom: clamp(1.625rem, 1.406rem + 0.899vw, 2.125rem);
}

.page-message__body {
  margin-top: 1.25rem;
  max-width: 46ch;
}

.page-message__action {
  margin-top: 2rem;
}

@media (min-width: 640px) {
  .page-message__action {
    align-self: flex-start;
  }
}

/* --------------------------------------------------------------------------
   13. Motion preferences
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  a.service-card:hover {
    transform: none;
  }
}
