/* ============================================================
   Tokens, as defined in the Figma file (Design-Portfolio)
   Two platforms, matching the Platform=Desktop / Platform=Mobile
   variants and frames (MacBook Pro 16" 1728 / iPhone 16 393).
   ============================================================ */
:root {
  /* Color variables (shared) */
  --portfolio-bg: #2D3226;            /* portfolioBg */
  --portfolio-text: #FFF7ED;          /* portfolioText */
  --portfolio-loading-wheel: #FFF7ED; /* portfolioLoadingWheel */
  --portfolio-icon-default: #FFF7ED;  /* portfolioIconDefault */
  --hero-top: #6E7B3C;                /* average color of the hero image's top edge (phones) */

  /* Font families (shared) */
  --font-h1: "campaign-slab", "Rockwell", "Roboto Slab", Georgia, serif;
  --font-p1: "alverata-informal", "Avenir Next", "Segoe UI", system-ui, sans-serif;

  /* ---- Desktop ---- */
  /* portfolioH1: Campaign Slab Regular 46 / Auto / 3% */
  --h1-size: 46px;
  --h1-weight: 400;
  --h1-leading: normal;      /* Auto in Figma (node override of the 100% style) */
  --h1-tracking: 0.03em;
  --h1-max: 488px;

  /* portfolioP1: Alverata Informal Light 18 / 24 */
  --p1-size: 18px;
  --p1-weight: 300;
  --p1-leading: 24px;
  --p1-tracking: 0;
  --p1-max: 400px;
  --p1-align: left;

  --stack-max: 488px;
  --gap-sections: 56px;      /* header -> paragraph -> icons */
  --gap-p-icons: 56px;       /* paragraph -> icons */
  --gap-intro: 56px;         /* wheel -> title */

  /* Loading Wheel (Platform=Desktop) */
  --wheel-w: 64.589px;
  --wheel-h: 63px;

  /* Icon (Platform=Desktop) */
  --gap-icons: 24px;
  --icon-box: 54px;
  --icon-radius: 6px;
  --icon-shadow-y: 4px;      /* hover drop shadow: x0 y4 blur 8.7, white 15% */
  --icon-shadow-blur: 8.7px;
}

/* ---- Mobile (Platform=Mobile): same system at 0.75x for the wheel and icons,
   with its own type styles. Below 1024px the 46px headline no longer fits the
   half-width column, so the layout switches to the stacked mobile design. ---- */
@media (max-width: 1023px) {
  :root {
    /* portfolio/mobile/H1: Campaign Slab Regular 28 / Auto / 3% */
    --h1-size: 28px;
    --h1-max: 360px;

    /* portfolio/mobile/P1: Alverata Informal Light 14 / 20 */
    --p1-size: 14px;
    --p1-leading: 20px;
    --p1-max: 261px;
    --p1-align: center;

    --gap-sections: 32px;
    --gap-p-icons: 68px;
    --gap-intro: 32px;

    --wheel-w: 48.442px;
    --wheel-h: 47.25px;

    --gap-icons: 12px;
    --icon-box: 40.5px;
    --icon-radius: 4.5px;
    --icon-shadow-y: 3px;
    --icon-shadow-blur: 6.525px;
  }
}

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

html {
  background: var(--portfolio-bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--portfolio-bg);
  color: var(--portfolio-text);
  font-family: var(--font-p1);
  font-weight: var(--p1-weight);
  font-size: var(--p1-size);
  line-height: var(--p1-leading);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   Page: image container is always half the viewport width (desktop)
   ============================================================ */
.page {
  display: grid;
  grid-template-columns: 50% 50%;
  min-height: 100vh;
  min-height: 100svh;
}

.image {
  background-color: #1b3a1f;
  background-image: url("images/hero.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* Content: padding 120 / 120 / 56 / 120 from Figma, content centered.
   The side padding relaxes (down to 24px) as the column narrows. */
.content {
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    clamp(64px, 10.74svh, 120px)
    clamp(24px, calc(25vw - 244px), 120px)
    56px;
  background: var(--portfolio-bg);
}

.stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--gap-sections);
  width: 100%;
  max-width: var(--stack-max);
  container-type: inline-size;
}

/* ============================================================
   Intro: Loading Wheel + H1
   ============================================================ */
.intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--gap-intro);
  width: 100%;
}

.loading-wheel {
  position: relative;
  width: var(--wheel-w);
  height: var(--wheel-h);
}

/* 7 frames stacked; each is on for 0.1s, then dissolves (0.05s ease-out)
   into the next. 7 x 0.15s = 1.05s loop, matching the Figma prototype.
   (Each SVG carries the component's own 75% opacity.) */
.loading-wheel img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  animation: wheel-step 1.05s ease-out infinite;
  animation-delay: calc(var(--i) * 150ms - 50ms);
}

@keyframes wheel-step {
  0%       { opacity: 0; }
  4.7619%  { opacity: 1; }   /*  50ms: dissolve in done        */
  14.2857% { opacity: 1; }   /* 150ms: next frame starts in    */
  19.0476% { opacity: 0; }   /* 200ms: dissolve out done       */
  100%     { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .loading-wheel img { animation: none; }
  .loading-wheel img:first-child { opacity: 1; }
}

.h1 {
  margin: 0;
  width: 100%;
  max-width: var(--h1-max);
  font-family: var(--font-h1);
  font-weight: var(--h1-weight);
  font-size: var(--h1-size);
  /* Fixed size whenever the column fits "CONSTRUCTION" (one unbreakable word);
     it only shrinks if the column is narrower than that word. */
  font-size: min(var(--h1-size), 9.8cqw);
  line-height: var(--h1-leading);
  letter-spacing: var(--h1-tracking);
  text-transform: uppercase;
  text-align: center;
  text-wrap: pretty;
  text-box: trim-both cap alphabetic; /* matches Figma's trimmed text boxes */
  color: var(--portfolio-text);
}

/* ============================================================
   P1
   ============================================================ */
.p1 {
  width: 100%;
  max-width: var(--p1-max);
  font-family: var(--font-p1);
  font-weight: var(--p1-weight);
  font-size: var(--p1-size);
  line-height: var(--p1-leading);
  letter-spacing: var(--p1-tracking);
  text-align: var(--p1-align);
  text-wrap: pretty;
  text-box: trim-both cap alphabetic; /* matches Figma's trimmed text boxes */
  color: var(--portfolio-text);
}

.p1 p { margin: 0; }
.p1 p + p { margin-top: var(--p1-leading); } /* blank line between paragraphs */

/* ============================================================
   Icon component (Style=Filled): Default <-> Hover, 0.3s ease-out
   ============================================================ */
.social-icons {
  display: flex;
  align-items: center;
  gap: var(--gap-icons);
  /* paragraph -> icons spacing (equals the stack gap on desktop) */
  margin-top: calc(var(--gap-p-icons) - var(--gap-sections));
}

.icon {
  position: relative;
  display: block;
  width: var(--icon-box);
  height: var(--icon-box);
  border-radius: var(--icon-radius);
  /* Hover state has a drop shadow in Figma (white 15%). CSS outer shadows are
     knocked out under the box, same as Figma's. */
  box-shadow: 0 var(--icon-shadow-y) var(--icon-shadow-blur) rgba(255, 255, 255, 0);
  transition: box-shadow 0.3s ease-out;
}

.icon__state {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transition: opacity 0.3s ease-out;
}

.icon__state--hover { opacity: 0; }

@media (hover: hover) {
  .icon:hover { box-shadow: 0 var(--icon-shadow-y) var(--icon-shadow-blur) rgba(255, 255, 255, 0.15); }
  .icon:hover .icon__state--default { opacity: 0; }
  .icon:hover .icon__state--hover { opacity: 1; }
}

.icon:focus-visible { outline: 2px solid var(--portfolio-text); outline-offset: 3px; }
.icon:focus-visible { box-shadow: 0 var(--icon-shadow-y) var(--icon-shadow-blur) rgba(255, 255, 255, 0.15); }
.icon:focus-visible .icon__state--default { opacity: 0; }
.icon:focus-visible .icon__state--hover { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .icon, .icon__state { transition: none; }
}

/* ============================================================
   Mobile layout (iPhone 16 frame, 393 x 852):
   The content block is fixed-size (16px top/sides, 64px inset above the
   wheel, 164px below the icons) and the image flexes to fill all the space
   above it, all the way to the top edge of the screen.
   ============================================================ */
@media (max-width: 1023px) {
  /* Overscroll / status-bar-area color: the image's top-edge color above,
     the page color below. */
  html {
    background: linear-gradient(to bottom, var(--hero-top) 50%, var(--portfolio-bg) 50%);
  }

  .page {
    grid-template-columns: 1fr;
    /* image: takes the remaining height (never shorter than 189px, plus the
       status-bar inset when the page runs full-screen) */
    grid-template-rows: minmax(calc(189px + env(safe-area-inset-top, 0px)), 1fr) auto;
    min-height: 100vh;
    min-height: 100dvh;
  }

  .content {
    align-items: flex-start;
    padding: 16px 16px 164px;
  }

  .stack { padding-top: 64px; }
}
