/* ==========================================================================
   Johnson Home Improvement Services — design tokens, reset and primitives
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */

:root {
  /* Surfaces, from page background up to the highest raised card */
  --ink: #08090c;
  --ink-raised: #0c0e13;
  --ink-card: #11141b;
  --ink-card-hi: #171b24;
  --ink-inverse: #f3f0e9;

  /* Text */
  --bone: #f4f1ea;
  --bone-soft: #d9d6cf;
  --text-dim: #a2aab7;
  --text-muted: #737d8b;
  --text-faint: #4d5663;

  /* Brand — steel blue sampled from the logo, plus a brass luxury accent */
  --steel: #5b96c0;
  --steel-bright: #7db4d8;
  --steel-deep: #2f5d7c;
  --steel-ink: #16283a;
  --brass: #c9a25a;
  --brass-bright: #e3c48d;
  --brass-deep: #8a6a30;

  /* Semantic */
  --success: #4fa87a;
  --danger: #cf6b5b;

  /* Lines and glass */
  --hairline: rgba(244, 241, 234, 0.09);
  --hairline-strong: rgba(244, 241, 234, 0.16);
  --hairline-bright: rgba(244, 241, 234, 0.28);
  --glass: rgba(18, 21, 28, 0.72);
  --sheen: rgba(255, 255, 255, 0.06);

  /* Radii */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-xl: 34px;
  --r-pill: 999px;

  /* Elevation. Layered rather than single-blur, so edges stay crisp. */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.38);
  --shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.42), 0 28px 70px rgba(0, 0, 0, 0.52);
  --shadow-glow: 0 20px 60px -20px rgba(91, 150, 192, 0.45);
  --inset-hi: inset 0 1px 0 rgba(255, 255, 255, 0.07);

  /* Fluid type scale (min viewport 380px, max 1440px) */
  --step--2: clamp(0.69rem, 0.67rem + 0.1vw, 0.75rem);
  --step--1: clamp(0.82rem, 0.79rem + 0.15vw, 0.9rem);
  --step-0: clamp(0.97rem, 0.94rem + 0.16vw, 1.06rem);
  --step-1: clamp(1.12rem, 1.05rem + 0.32vw, 1.31rem);
  --step-2: clamp(1.32rem, 1.19rem + 0.58vw, 1.66rem);
  --step-3: clamp(1.55rem, 1.32rem + 1vw, 2.14rem);
  --step-4: clamp(1.83rem, 1.44rem + 1.7vw, 2.8rem);
  --step-5: clamp(2.15rem, 1.52rem + 2.72vw, 3.75rem);
  --step-6: clamp(2.53rem, 1.5rem + 4.45vw, 5.13rem);
  --step-7: clamp(2.98rem, 1.29rem + 7.3vw, 7.2rem);

  /* Spacing */
  --space-2xs: 0.25rem;
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4.5rem;
  --space-4xl: 7rem;

  /* Section rhythm scales with the viewport */
  --section-y: clamp(4.5rem, 9vw, 9.5rem);
  --gutter: clamp(1.25rem, 4.2vw, 3.5rem);
  --measure: 68ch;

  /* Layout */
  --container: 1340px;
  --container-narrow: 940px;
  --header-h: 76px;

  /* Type families */
  --font-body: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Inter Tight', 'Inter', ui-sans-serif, system-ui, sans-serif;
  --font-serif: 'Instrument Serif', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --t-fast: 140ms;
  --t-base: 260ms;
  --t-slow: 520ms;
  --t-slower: 900ms;

  /* Stacking */
  --z-base: 1;
  --z-sticky: 40;
  --z-header: 60;
  --z-overlay: 80;
  --z-modal: 90;
  --z-cursor: 120;
}

/* --------------------------------------------------------------------------
   2. Reset
   -------------------------------------------------------------------------- */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Anchor targets clear the fixed header */
  scroll-padding-top: calc(var(--header-h) + 1.5rem);
}

body {
  background-color: var(--ink);
  color: var(--bone);
  font-family: var(--font-body);
  font-size: var(--step-0);
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1;
  min-height: 100vh;
  overflow-x: hidden;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

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

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

p,
h1,
h2,
h3,
h4,
h5,
h6,
li {
  overflow-wrap: break-word;
}

ul[role='list'],
ol[role='list'] {
  list-style: none;
  padding: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

address {
  font-style: normal;
}

svg {
  fill: currentColor;
  flex-shrink: 0;
}

::selection {
  background: var(--steel-deep);
  color: var(--bone);
}

:focus-visible {
  outline: 2px solid var(--steel-bright);
  outline-offset: 3px;
  border-radius: 3px;
}

/* Keep the layout from shifting when a dialog locks scrolling */
html.is-locked {
  overflow: hidden;
  /* Padding is applied via JS to match the scrollbar width */
}

/* --------------------------------------------------------------------------
   3. Typography
   -------------------------------------------------------------------------- */

h1,
h2,
h3,
h4,
h5 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

h1 {
  font-size: var(--step-6);
}
h2 {
  font-size: var(--step-5);
}
h3 {
  font-size: var(--step-3);
  line-height: 1.14;
  letter-spacing: -0.028em;
}
h4 {
  font-size: var(--step-1);
  line-height: 1.25;
  letter-spacing: -0.02em;
}
h5 {
  font-size: var(--step-0);
  letter-spacing: -0.015em;
}

p {
  text-wrap: pretty;
}

/* Editorial serif accent, used for a few words inside a heading */
.serif {
  font-family: var(--font-serif);
  font-weight: 400;
  font-style: italic;
  letter-spacing: -0.01em;
  /* The serif is optically smaller than the sans at the same size */
  font-size: 1.12em;
  line-height: 0.95;
}

.gradient-text {
  background: linear-gradient(96deg, var(--bone) 12%, var(--steel-bright) 58%, var(--brass-bright) 96%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  /* Descenders get clipped without a little breathing room */
  padding-block-end: 0.06em;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.7em;
  font-family: var(--font-mono);
  font-size: var(--step--2);
  font-weight: 500;
  letter-spacing: 0.19em;
  text-transform: uppercase;
  color: var(--brass);
}

.eyebrow::before {
  content: '';
  width: 1.75rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--brass));
  flex: none;
}

.eyebrow--center::before {
  background: var(--brass);
  width: 1.25rem;
}

.eyebrow--plain::before {
  display: none;
}

.lede {
  font-size: var(--step-1);
  line-height: 1.58;
  color: var(--text-dim);
  max-width: 56ch;
  font-weight: 350;
}

.prose {
  max-width: var(--measure);
  color: var(--text-dim);
  line-height: 1.72;
}

.prose > * + * {
  margin-block-start: 1.15em;
}

.prose strong {
  color: var(--bone);
  font-weight: 600;
}

.prose em {
  font-family: var(--font-serif);
  font-size: 1.1em;
  color: var(--bone-soft);
}

.text-dim {
  color: var(--text-dim);
}
.text-muted {
  color: var(--text-muted);
}
.text-brass {
  color: var(--brass);
}
.text-steel {
  color: var(--steel-bright);
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* --------------------------------------------------------------------------
   4. Layout primitives
   -------------------------------------------------------------------------- */

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

.container--narrow {
  max-width: var(--container-narrow);
}

.container--wide {
  max-width: 1560px;
}

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

.section--tight {
  padding-block: clamp(3rem, 6vw, 5.5rem);
}

.section--flush-top {
  padding-block-start: 0;
}

.section--flush-bottom {
  padding-block-end: 0;
}

/* Alternating tonal band, edged with hairlines */
.section--raised {
  background: var(--ink-raised);
  border-block: 1px solid var(--hairline);
}

.stack > * + * {
  margin-block-start: var(--flow, 1rem);
}

.grid {
  display: grid;
  gap: var(--grid-gap, clamp(1rem, 2.2vw, 1.75rem));
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--cluster-gap, 0.75rem);
}

.section-head {
  display: grid;
  gap: clamp(1rem, 2vw, 1.6rem);
  max-width: 62rem;
}

.section-head--center {
  justify-items: center;
  text-align: center;
  margin-inline: auto;
}

/* Header with a title on the left and a link/control on the right */
.section-head--split {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  max-width: none;
  gap: clamp(1rem, 3vw, 2.5rem);
}

@media (max-width: 720px) {
  .section-head--split {
    grid-template-columns: 1fr;
    align-items: start;
  }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* An icon sitting in a run of text, e.g. naming a button in a caption */
.inline-icon {
  width: 1em;
  height: 1em;
  vertical-align: -0.15em;
  color: var(--brass);
}

/* Skip link, visible only once focused */
.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 50%;
  transform: translate(-50%, -160%);
  z-index: 200;
  padding: 0.7rem 1.25rem;
  background: var(--bone);
  color: var(--ink);
  border-radius: var(--r-pill);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--step--1);
  transition: transform var(--t-base) var(--ease-out);
}

.skip-link:focus-visible {
  transform: translate(-50%, 0);
}

/* --------------------------------------------------------------------------
   5. Atmosphere — grain, glows, hairlines
   -------------------------------------------------------------------------- */

/* Film grain over the whole page. Fixed so it never scrolls with content. */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: 0.032;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Soft radial light source. Positioned by modifier classes. */
.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
}

.glow--steel {
  background: radial-gradient(circle, rgba(91, 150, 192, 0.5), transparent 68%);
}

.glow--brass {
  background: radial-gradient(circle, rgba(201, 162, 90, 0.35), transparent 68%);
}

/* Hairline divider that fades at both ends */
.rule {
  height: 1px;
  border: 0;
  background: linear-gradient(90deg, transparent, var(--hairline-strong) 18%, var(--hairline-strong) 82%, transparent);
}

/* --------------------------------------------------------------------------
   6. Scroll-reveal
   -------------------------------------------------------------------------- */

/* Elements start hidden only once JS confirms it can reveal them, so the page
   stays readable if scripts fail. */
.js-reveal [data-reveal] {
  opacity: 0;
  transform: translate3d(0, var(--reveal-y, 26px), 0) scale(var(--reveal-scale, 1));
  transition:
    opacity var(--t-slow) var(--ease-out),
    transform var(--t-slow) var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}

.js-reveal [data-reveal='fade'] {
  --reveal-y: 0px;
}

.js-reveal [data-reveal='rise'] {
  --reveal-y: 40px;
}

.js-reveal [data-reveal='zoom'] {
  --reveal-y: 18px;
  --reveal-scale: 0.965;
}

.js-reveal [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

/* Headline text that resolves line by line */
.js-reveal .line-mask {
  display: block;
  overflow: hidden;
  /* Room for descenders inside the clipping box */
  padding-block-end: 0.12em;
  margin-block-end: -0.12em;
}

.js-reveal .line-mask > span {
  display: block;
  transform: translate3d(0, 110%, 0);
  transition: transform 900ms var(--ease-out);
  transition-delay: var(--line-delay, 0ms);
}

.js-reveal .is-visible .line-mask > span,
.js-reveal .line-mask.is-visible > span {
  transform: none;
}

/* --------------------------------------------------------------------------
   7. Utilities
   -------------------------------------------------------------------------- */

.full-bleed {
  width: 100vw;
  margin-inline: calc(50% - 50vw);
}

.relative {
  position: relative;
}
.z-1 {
  position: relative;
  z-index: 1;
}
.no-scrollbar {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.no-scrollbar::-webkit-scrollbar {
  display: none;
}

.aspect-square {
  aspect-ratio: 1;
}
.aspect-video {
  aspect-ratio: 16 / 9;
}
.aspect-portrait {
  aspect-ratio: 4 / 5;
}

.cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 700px) {
  .hide-mobile {
    display: none !important;
  }
}

@media (min-width: 701px) {
  .hide-desktop {
    display: none !important;
  }
}

/* --------------------------------------------------------------------------
   8. Reduced motion
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .js-reveal [data-reveal],
  .js-reveal .line-mask > span {
    opacity: 1 !important;
    transform: none !important;
  }
}
