/* ==========================================================================
   Myles Manoli — Portfolio
   Design tokens
   ========================================================================== */

:root {
  /* Color */
  --bg: #fbfbf9;
  --surface: #ffffff;
  --ink: #12233b;            /* dark navy — headings, primary text */
  --ink-soft: #4a586e;       /* slate — body copy */
  --ink-faint: #8a94a6;      /* captions, labels */
  --line: #e5e8ee;           /* hairline borders */
  --line-strong: #d3d9e3;
  --accent: #1d4e89;         /* restrained institutional blue */
  --accent-hover: #163c6a;
  --accent-soft: #eef3f9;    /* pale blue wash */
  --green: #1e6a52;          /* deep green — secondary accent */
  --green-soft: #ecf4f0;
  --footer-bg: #12233b;

  /* Type */
  --font-display: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* Spacing scale (spacious) */
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;
  --space-6: 6rem;

  /* Misc */
  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(18, 35, 59, 0.05);
  --shadow-md: 0 6px 24px -8px rgba(18, 35, 59, 0.12);
  --shadow-lg: 0 16px 40px -12px rgba(18, 35, 59, 0.18);
  --header-h: 72px;
}

/* ==========================================================================
   Reset & base
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink-soft);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--accent);
  text-decoration: none;
}

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

.container {
  width: min(1120px, 100% - 3rem);
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: #fff;
  padding: 0.75rem 1.25rem;
  z-index: 100;
  border-radius: 0 0 var(--radius) 0;
}

.skip-link:focus {
  left: 0;
}

/* ==========================================================================
   Typography helpers
   ========================================================================== */

.eyebrow {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: var(--space-2);
}

.section-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.9rem, 3.5vw, 2.6rem);
  line-height: 1.15;
  color: var(--ink);
  margin-bottom: var(--space-2);
}

.section-sub {
  max-width: 56ch;
  font-size: 1.0625rem;
}

/* ==========================================================================
   Navigation
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(251, 251, 249, 0.92);
  backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.site-header.is-scrolled {
  border-bottom-color: var(--line);
  box-shadow: var(--shadow-sm);
}

.nav-inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.logo-mark {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  flex-shrink: 0;
}

.logo-mark-lg {
  width: 48px;
  height: 48px;
  border-radius: 9px;
}

.logo-mark-footer {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.wordmark-light {
  color: #fff;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.nav-link {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink);
  padding: 0.5rem 0;
  position: relative;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}

.nav-link:hover::after,
.nav-link:focus-visible::after {
  transform: scaleX(1);
}

.nav-cta {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  padding: 0.65rem 1.35rem;
  border-radius: var(--radius);
  transition: background 0.2s ease, transform 0.2s ease;
}

.nav-cta:hover {
  background: var(--accent-hover);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  cursor: pointer;
  align-items: center;
}

.nav-toggle-bar {
  width: 22px;
  height: 2px;
  background: var(--ink);
  transition: transform 0.25s ease, opacity 0.25s ease;
}

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

.hero {
  padding: var(--space-6) 0 var(--space-5);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: var(--space-5);
  align-items: center;
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  line-height: 1.12;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin-bottom: var(--space-3);
}

.hero-title em {
  font-style: italic;
  color: var(--accent);
}

.hero-sub {
  font-size: 1.125rem;
  max-width: 54ch;
  margin-bottom: var(--space-4);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease,
    box-shadow 0.2s ease, transform 0.2s ease;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}

.btn-secondary:hover {
  border-color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.hero-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  border-top: 1px solid var(--line);
  padding-top: var(--space-3);
}

.fact dt {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.35rem;
}

.fact dd {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.4;
}

.hero-portrait {
  justify-self: end;
  width: min(360px, 100%);
}

.portrait-frame {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.portrait-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(18, 35, 59, 0.08);
  border-radius: var(--radius);
  pointer-events: none;
}

.portrait-frame img {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.portrait-caption {
  margin-top: var(--space-2);
  font-size: 0.875rem;
  color: var(--ink-faint);
  text-align: center;
}

/* ==========================================================================
   Credentials strip
   ========================================================================== */

.credentials {
  border-block: 1px solid var(--line);
  background: var(--surface);
  padding: var(--space-3) 0;
}

.credentials-inner {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.credentials-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  white-space: nowrap;
}

.credentials-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  list-style: none;
}

.credentials-list li {
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--ink-soft);
}

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

.projects {
  padding: var(--space-6) 0;
}

.section-head {
  max-width: 640px;
  margin-bottom: var(--space-5);
}

.projects-grid {
  display: grid;
  /* minmax(0,1fr) — without the 0 floor, the wide slide images force
     the tracks past the container width */
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.25s ease, transform 0.25s ease, border-color 0.25s ease;
}

.project-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
  border-color: var(--line-strong);
}

.project-card-body {
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex-grow: 1;
}

/* Cover thumbnail — the whole image is the click target */
.project-thumb {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  border-bottom: 1px solid var(--line);
  background: var(--accent-soft);
  cursor: pointer;
  overflow: hidden;
}

.project-thumb img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: top center;
  transition: transform 0.4s ease;
}

.project-card:hover .project-thumb img {
  transform: scale(1.02);
}

.project-thumb-badge {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #fff;
  background: rgba(18, 35, 59, 0.82);
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
}

.project-thumb-empty {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  border-bottom: 1px dashed var(--line-strong);
  background: repeating-linear-gradient(
    -45deg,
    var(--bg),
    var(--bg) 10px,
    rgba(29, 78, 137, 0.03) 10px,
    rgba(29, 78, 137, 0.03) 20px
  );
}

.project-thumb-empty img {
  opacity: 0.28;
}

.project-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: var(--space-1);
}

.project-download {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink-faint);
  padding: 0.25rem 0;
}

.project-download:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.project-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.project-tag {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--green);
  background: var(--green-soft);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
}

.project-date {
  font-size: 0.8125rem;
  color: var(--ink-faint);
}

.project-title {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.25;
}

.project-desc {
  font-size: 0.9375rem;
  flex-grow: 1;
}

.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
}

.project-meta li {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-soft);
  background: var(--accent-soft);
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
}

.project-link {
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--accent);
  background: none;
  border: none;
  padding: 0.25rem 0;
  cursor: pointer;
}

.project-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* Placeholder state — clearly unfinished, intentionally quiet */
.project-card.is-placeholder {
  border-style: dashed;
  border-color: var(--line-strong);
  background: transparent;
  box-shadow: none;
}

.project-card.is-placeholder:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--ink-faint);
}

.project-card.is-placeholder .project-tag {
  color: var(--ink-faint);
  background: var(--bg);
  border: 1px solid var(--line);
}

.project-card.is-placeholder .project-title,
.project-card.is-placeholder .project-desc {
  color: var(--ink-faint);
}

.project-card.is-placeholder .project-meta {
  visibility: hidden;
}

/* ==========================================================================
   Contact
   ========================================================================== */

.contact {
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: var(--space-6) 0;
}

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
  align-items: start;
}

.contact-channels {
  list-style: none;
  margin-top: var(--space-4);
  display: grid;
  gap: var(--space-3);
}

.contact-channels li {
  display: grid;
  gap: 0.2rem;
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--line);
}

.channel-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.channel-value {
  font-size: 1.0625rem;
  font-weight: 500;
  color: var(--ink);
}

a.channel-value:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.contact-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-4);
  display: grid;
  gap: var(--space-2);
  justify-items: start;
  box-shadow: var(--shadow-sm);
}

.contact-card-title {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--ink);
}

.contact-card-sub {
  font-size: 0.9375rem;
  margin-bottom: var(--space-1);
}

.contact-card-btn {
  width: 100%;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  background: var(--footer-bg);
  color: rgba(255, 255, 255, 0.75);
  padding: var(--space-5) 0 var(--space-3);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-4);
  flex-wrap: wrap;
  padding-bottom: var(--space-4);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.footer-tag {
  font-size: 0.875rem;
  margin-top: 0.35rem;
  color: rgba(255, 255, 255, 0.55);
}

.footer-links {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.5rem 0;
}

.footer-links a:hover {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.footer-legal {
  padding-top: var(--space-3);
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.5);
}

/* ==========================================================================
   Slide viewer (modal lightbox)
   ========================================================================== */

.viewer {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(10, 20, 34, 0.94);
  display: flex;
  flex-direction: column;
  padding: var(--space-2) var(--space-3) var(--space-3);
  gap: var(--space-2);
}

.viewer[hidden] {
  display: none;
}

.viewer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  color: #fff;
  flex-shrink: 0;
}

.viewer-title {
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.3;
}

.viewer-tools {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

.viewer-counter {
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
}

.viewer-download {
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
}

.viewer-download:hover {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.viewer-close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  background: transparent;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.viewer-close:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.5);
}

.viewer-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}

.viewer-figure {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.viewer-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.7);
}

.viewer-nav {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.viewer-nav:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.5);
}

.viewer-nav:disabled {
  opacity: 0.25;
  cursor: default;
}

.viewer-hint {
  text-align: center;
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.45);
  flex-shrink: 0;
}

body.viewer-open {
  overflow: hidden;
}

@media (max-width: 720px) {
  .viewer {
    padding: var(--space-2);
  }

  .viewer-title {
    font-size: 0.9375rem;
    width: 100%;
  }

  .viewer-tools {
    width: 100%;
    justify-content: space-between;
  }

  /* Overlay the arrows so the slide itself gets the full screen width —
     side-by-side they squeeze a 16:9 slide down to an unreadable size */
  .viewer-stage {
    position: relative;
    gap: 0;
  }

  .viewer-figure {
    width: 100%;
  }

  .viewer-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 44px;
    height: 44px;
    background: rgba(10, 20, 34, 0.72);
    backdrop-filter: blur(4px);
  }

  .viewer-prev {
    left: 0;
  }

  .viewer-next {
    right: 0;
  }

  .viewer-nav:disabled {
    opacity: 0;
    pointer-events: none;
  }

  .viewer-hint {
    display: none;
  }
}

/* ==========================================================================
   Reveal animation (subtle, respects reduced motion)
   ========================================================================== */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

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

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .btn,
  .project-card {
    transition: none;
  }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  .hero-portrait {
    justify-self: start;
    order: -1;
    width: min(280px, 70%);
  }

  .portrait-caption {
    text-align: left;
  }

  .contact-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
}

@media (max-width: 720px) {
  .nav-toggle {
    display: flex;
  }

  .nav-links {
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-md);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: var(--space-2) var(--space-3) var(--space-3);
    display: none;
  }

  .nav-links.is-open {
    display: flex;
  }

  .nav-link {
    padding: 0.9rem 0.25rem;
    border-bottom: 1px solid var(--line);
    min-height: 48px;
    display: flex;
    align-items: center;
  }

  .nav-link::after {
    display: none;
  }

  .nav-cta {
    margin-top: var(--space-2);
    text-align: center;
    justify-content: center;
    display: flex;
  }

  .nav-toggle[aria-expanded="true"] .nav-toggle-bar:first-child {
    transform: translateY(4px) rotate(45deg);
  }

  .nav-toggle[aria-expanded="true"] .nav-toggle-bar:last-child {
    transform: translateY(-4px) rotate(-45deg);
  }

  .hero {
    padding-top: var(--space-4);
  }

  .hero-facts {
    grid-template-columns: 1fr;
    gap: var(--space-2);
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }

  .footer-inner {
    flex-direction: column;
  }
}
