/* "Our Work" hub: preview of the portfolio section for the Spectrix site.
   Matches the main site's look (near-black, white type, square buttons, spaced caps). */

:root {
  --bg: #050505;
  --panel: rgba(12, 12, 12, 0.8);
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #fff;
  --text-2: #aaa;
  --text-3: #777;
  --gutter: 24px;
  color-scheme: dark;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', 'Inter', 'Poppins', system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* page scroll is locked on <html> while the device preview is open
   (locking <body> instead makes Chrome misreport the page width) */
html.is-previewing {
  overflow: hidden;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

/* same width as the main site's .site-wrapper (1400px, 40px sides on desktop) */
.container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

@media (min-width: 1024px) {
  :root {
    --gutter: 40px;
  }
}

/* ===== Top bar ===== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(5, 5, 5, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  text-decoration: none;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 3px;
  white-space: nowrap;
}

.brand span {
  font-weight: 400;
  font-size: 12px;
  color: var(--text-3);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid var(--line-strong);
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text-2);
  white-space: nowrap;
  transition: color 0.25s ease, border-color 0.25s ease;
}

.back-link:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* goes to the contact form on the home page */
.contact-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 18px;
  background: #fff;
  color: #050505;
  border: 1px solid #fff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.25s ease;
}

.contact-link:hover {
  background: #ddd;
}

/* phones: "Back to site" becomes an arrow-only button so both fit next to the logo */
@media (max-width: 639px) {
  .back-text {
    display: none;
  }

  .back-link {
    justify-content: center;
    width: 40px;
    padding: 0;
  }
}

/* ===== Hero ===== */

.hero {
  padding: clamp(20px, 3vw, 32px) 0 clamp(36px, 5vw, 56px);
}

/* Text only on phones and tablets; from 1024px the app screenshots fill the right-hand side */
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 48px;
}

/* text stays right under the top bar even when the screenshot stack is the taller column */
.hero-copy {
  min-width: 0;
  align-self: start;
}

.hero-stack {
  display: none;
}

@media (min-width: 1024px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: clamp(40px, 5vw, 80px);
  }

  .hero-stack {
    display: block;
    position: relative;
    aspect-ratio: 16 / 12;
  }
}

.hero-stack figure {
  position: absolute;
  margin: 0;
}

.hs-card {
  width: 78%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  overflow: hidden;
  background: #0d0d0d;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.7);
}

.hs-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 18px;
  padding: 0 9px;
  background: #121212;
  border-bottom: 1px solid var(--line);
}

.hs-bar i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #333;
}

/* the <picture> wrappers only pick the image source; lay the images out as if they weren't there */
.hero-stack picture {
  display: contents;
}

.hero-stack img {
  width: 100%;
  height: auto;
  object-fit: cover;
  background: #0d0d0d;
}

.hs-card img {
  aspect-ratio: 1440 / 900;
  object-position: top left;
}

/* front card bottom left, the others stepping back to the top right, dimmed */
.hs-front {
  left: 0;
  top: 28%;
  z-index: 3;
}

.hs-middle {
  left: 11%;
  top: 14%;
  z-index: 2;
  filter: brightness(0.7);
}

.hs-back {
  left: 22%;
  top: 0;
  z-index: 1;
  filter: brightness(0.5);
}

.hs-phone {
  right: 0;
  bottom: 0;
  z-index: 4;
  width: 20%;
  padding: 4px;
  border-radius: 18px;
  background: #1a1a1a;
  border: 1px solid var(--line-strong);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8);
}

.hs-phone img {
  aspect-ratio: 390 / 844;
  object-position: top;
  border-radius: 14px;
}

.hero-badge {
  display: inline-block;
  padding: 6px 15px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 30px;
  font-size: 12px;
  letter-spacing: 2px;
  margin-bottom: 28px;
}

.hero h1 {
  margin: 0 0 24px;
  font-size: clamp(40px, 10vw, 72px);
  font-weight: 800;
  line-height: 1.08;
}

.hero h1 span {
  background: linear-gradient(135deg, #fff, #8a8a8a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-text {
  max-width: 680px;
  margin: 0 0 40px;
  font-size: clamp(16px, 4.2vw, 18px);
  color: var(--text-2);
  line-height: 1.8;
}

.jump {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.jump a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--line-strong);
  text-decoration: none;
  font-size: 14px;
  letter-spacing: 0.5px;
  transition: background 0.25s ease, border-color 0.25s ease;
}

.jump a b {
  font-weight: 700;
  color: var(--text-3);
}

.jump a:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.35);
}

/* ===== Projects ===== */

.project {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 48px;
  padding: clamp(48px, 8vw, 96px) 0;
  border-top: 1px solid var(--line);
}

.project-media {
  position: relative;
  min-width: 0;
  /* room for the phone that hangs below the laptop frame */
  padding-bottom: 12%;
}

.project-media figure {
  margin: 0;
}

.frame-desktop {
  position: relative;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #0d0d0d;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

.frame-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  background: #111;
}

.frame-bar i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #2b2b2b;
}

.frame-bar span {
  margin-left: 10px;
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.frame-desktop img {
  width: 100%;
  height: auto;
  aspect-ratio: 1440 / 900;
  object-fit: cover;
  object-position: top left;
  background: #0d0d0d;
}

.frame-phone {
  position: absolute;
  right: 3%;
  bottom: 0;
  width: 25%;
  min-width: 92px;
  padding: 5px;
  border-radius: 24px;
  background: #1a1a1a;
  border: 1px solid var(--line-strong);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75);
}

.frame-phone img {
  width: 100%;
  height: auto;
  aspect-ratio: 390 / 844;
  object-fit: cover;
  object-position: top;
  border-radius: 19px;
  background: #0d0d0d;
}

.project-body {
  min-width: 0;
}

.project-index {
  display: block;
  font-size: clamp(48px, 10vw, 72px);
  font-weight: 800;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255, 255, 255, 0.28);
  margin-bottom: 16px;
}

.tag {
  display: block;
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--text-3);
  margin-bottom: 10px;
}

.project h2 {
  margin: 0 0 16px;
  font-size: clamp(32px, 7vw, 44px);
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 1.15;
}

.lede {
  margin: 0 0 24px;
  color: var(--text-2);
  font-size: 17px;
  line-height: 1.75;
}

.features {
  list-style: none;
  margin: 0 0 32px;
  padding: 0;
  display: grid;
  gap: 12px;
}

.features li {
  position: relative;
  padding-left: 28px;
  color: #ddd;
  font-size: 15px;
}

.features li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 0.45em;
  width: 12px;
  height: 7px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.btn-primary,
.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 14px 30px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 1px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.btn-primary {
  background: #fff;
  color: #050505;
  border: 1px solid #fff;
}

.btn-primary:hover {
  background: #ddd;
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(255, 255, 255, 0.1);
}

.btn-outline {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-outline:hover {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-2px);
}

@media (min-width: 1024px) {
  .project {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 72px;
    align-items: center;
  }

  .project:nth-child(even) .project-media {
    order: 2;
  }

  .project:nth-child(even) .frame-phone {
    right: auto;
    left: 3%;
  }
}

/* ===== CTA + footer ===== */

.cta {
  border-top: 1px solid var(--line);
  padding: clamp(56px, 10vw, 96px) 0;
}

.cta-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.cta h2 {
  margin: 0 0 10px;
  font-size: clamp(26px, 6vw, 36px);
  line-height: 1.2;
}

.cta h2 span {
  color: #555;
}

.cta p {
  margin: 0;
  color: var(--text-3);
  font-size: 17px;
}

.footer {
  border-top: 1px solid var(--line);
  padding: 28px 0 36px;
  color: var(--text-3);
  font-size: 13px;
}

.footer p {
  margin: 0;
}

@media (max-width: 639px) {
  :root {
    --gutter: 16px;
  }

  .brand span {
    display: none;
  }

  .project {
    gap: 36px;
  }

  .project-media {
    padding-bottom: 18%;
  }

  .frame-phone {
    width: 30%;
    border-radius: 16px;
    padding: 3px;
  }

  .frame-phone img {
    border-radius: 13px;
  }

  .actions > * {
    flex: 1 1 100%;
  }

  .cta-inner > .btn-primary {
    width: 100%;
  }
}

/* ===== Device preview (full-screen dialog with the live demo in an iframe) ===== */

.viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.viewer[hidden] {
  display: none;
}

.viewer-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}

.viewer-bar strong {
  font-size: 16px;
  letter-spacing: 1px;
  margin-right: 4px;
}

.seg {
  display: inline-flex;
  border: 1px solid var(--line-strong);
}

.seg button {
  min-height: 38px;
  padding: 6px 14px;
  background: transparent;
  border: 0;
  border-right: 1px solid var(--line-strong);
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.5px;
  cursor: pointer;
}

.seg button:last-child {
  border-right: 0;
}

.seg button[aria-pressed='true'] {
  background: #fff;
  color: #050505;
  font-weight: 600;
}

.viewer-size {
  font-size: 12px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.viewer-open {
  margin-left: auto;
  font-size: 13px;
  color: var(--text-2);
  text-decoration: none;
  white-space: nowrap;
}

.viewer-open:hover {
  color: #fff;
}

.viewer-close {
  width: 38px;
  height: 38px;
  background: transparent;
  border: 1px solid var(--line-strong);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
}

.viewer-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: hidden;
}

.device {
  position: relative;
  overflow: hidden;
  background: #111;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
}

.device.is-phone,
.device.is-tablet {
  border: 8px solid #1a1a1a;
  outline: 1px solid var(--line-strong);
  border-radius: 34px;
}

.device.is-tablet {
  border-radius: 22px;
}

.device iframe {
  position: absolute;
  top: 0;
  left: 0;
  border: 0;
  background: #fff;
  transform-origin: 0 0;
}

@media (max-width: 639px) {
  .viewer-size {
    display: none;
  }

  .viewer-open {
    margin-left: 0;
  }

  .viewer-close {
    margin-left: auto;
  }

  .viewer-bar strong {
    flex: 1 1 auto;
  }
}

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

  .btn-primary,
  .btn-outline,
  .jump a {
    transition: none;
  }
}
