/* ========================================
   4thline Portfolio - Main Stylesheet
   ======================================== */

/* Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  overscroll-behavior-y: contain;
}

/* Skip to content link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  padding: 0.5rem 1rem;
  background: var(--text-color);
  color: var(--bg-color);
  z-index: 10000;
  font-size: 0.875rem;
  text-decoration: none;
  border-radius: 0 0 4px 4px;
}

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

/* Focus styles */
:focus-visible {
  outline: 2px solid var(--text-color);
  outline-offset: 2px;
}

.theme-dark :focus-visible {
  outline-color: #fff;
}

.lightbox :focus-visible {
  outline-color: #fff;
}

.menu-overlay :focus-visible {
  outline-color: #fff;
}

/* Reset button styles for lightbox nav zones */
.lightbox-nav-zone {
  -webkit-appearance: none;
  appearance: none;
  border: none;
  background: none;
  font: inherit;
}

/* ========================================
   Theme Variables
   ======================================== */
:root {
  --bg-color: #f8f5f0;
  --text-color: #1a1a2e;
  --text-muted: rgba(0, 0, 0, 0.55);
  --border-color: rgba(0, 0, 0, 0.1);
  --font-family: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --header-height: 5.3rem;
}

/* Base */
body {
  font-family: var(--font-family);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: var(--header-height);
}

/* ========================================
   Image Loading - Fade In
   ======================================== */
img {
  opacity: 0;
  transition: opacity 0.4s ease;
}

img.loaded {
  opacity: 1;
}

body.menu-open {
  overflow: hidden;
}

/* Theme: Light (default) */
body {
  background: var(--bg-color);
  color: var(--text-color);
}

/* Theme: Dark */
body.theme-dark {
  --bg-color: #111;
  --text-color: #fff;
  --text-muted: rgba(255, 255, 255, 0.55);
  --border-color: rgba(255, 255, 255, 0.15);
  background: var(--bg-color);
  color: var(--text-color);
}

/* ========================================
   Header
   ======================================== */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2rem 3rem;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(248, 245, 240, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 100;
}

[data-bg="white"] header {
  background: rgba(255, 255, 255, 0.85);
}

[data-bg="offwhite"] header {
  background: rgba(248, 245, 240, 0.85);
}

[data-bg="lightblue"] header {
  background: rgba(238, 243, 248, 0.85);
}

[data-bg="darkoffwhite"] header {
  background: rgba(237, 234, 229, 0.85);
}

body.theme-dark header {
  background: rgba(17, 17, 17, 0.85);
}

body.menu-open header {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.logo {
  font-size: 1.3rem;
  font-weight: 400;
  letter-spacing: 0.15em;
  transition: color 0.3s ease;
  line-height: 1;
}

.logo a {
  text-decoration: none;
  color: inherit;
  position: relative;
}

.logo a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s ease;
}

.logo a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

body.menu-open .logo {
  color: #fff;
}

/* Dark theme header */
body.theme-dark .logo {
  color: #fff;
}

/* ========================================
   Menu Button - Hamburger to X morph
   ======================================== */
.menu-btn {
  width: 28px;
  height: 20px;
  position: relative;
  cursor: pointer;
  background: none;
  border: none;
  z-index: 110;
}

.menu-btn span {
  display: block;
  position: absolute;
  height: 1.5px;
  width: 100%;
  background: #1a1a2e;
  left: 0;
  transition: all 0.3s ease;
}

.menu-btn span:nth-child(1) {
  top: 0;
}

.menu-btn span:nth-child(2) {
  top: 50%;
  transform: translateY(-50%);
  width: 70%;
}

.menu-btn span:nth-child(3) {
  bottom: 0;
}

.menu-btn:hover span {
  width: 100%;
}

/* Dark theme menu button */
body.theme-dark .menu-btn span {
  background: #fff;
}

/* Menu button open state - morph to X */
body.menu-open .menu-btn span {
  background: #fff;
}

body.menu-open .menu-btn span:nth-child(1) {
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
}

body.menu-open .menu-btn span:nth-child(2) {
  opacity: 0;
  width: 0;
}

body.menu-open .menu-btn span:nth-child(3) {
  bottom: 50%;
  transform: translateY(50%) rotate(-45deg);
}

/* ========================================
   Full Screen Menu Overlay
   ======================================== */
.menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  background: #111;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

body.menu-open .menu-overlay {
  opacity: 1;
  visibility: visible;
}

.menu-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6rem;
  width: 100%;
  max-width: 1000px;
  padding: 0 4rem 4rem;
}

.menu-col {
  display: flex;
  flex-direction: column;
}

.menu-col:first-child {
  text-align: right;
}

.menu-col:last-child {
  text-align: left;
  justify-content: flex-end;
  padding-bottom: 1rem;
}

.menu-label {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 2rem;
  transform: translateY(20px);
  opacity: 0;
  transition: transform 0.4s ease 0.05s, opacity 0.4s ease 0.05s;
}

body.menu-open .menu-label {
  transform: translateY(0);
  opacity: 1;
}

.menu-nav {
  list-style: none;
}

.menu-nav li {
  margin: 0.75rem 0;
  overflow: hidden;
}

.menu-nav a {
  display: inline-block;
  color: #fff;
  text-decoration: none;
  font-size: 2rem;
  font-weight: 300;
  letter-spacing: 0.05em;
  transition: opacity 0.2s ease, transform 0.4s ease;
  transform: translateY(100%);
  opacity: 0;
  position: relative;
}

.menu-nav a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: #fff;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s ease;
}

.menu-nav a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

body.menu-open .menu-nav a {
  transform: translateY(0);
  opacity: 1;
}

.menu-nav li:nth-child(1) a { transition-delay: 0.1s; }
.menu-nav li:nth-child(2) a { transition-delay: 0.15s; }
.menu-nav li:nth-child(3) a { transition-delay: 0.2s; }
.menu-nav li:nth-child(4) a { transition-delay: 0.25s; }
.menu-nav li:nth-child(5) a { transition-delay: 0.3s; }
.menu-nav li:nth-child(6) a { transition-delay: 0.35s; }

.menu-nav a:hover {
  opacity: 1;
}

.menu-secondary {
  list-style: none;
}

.menu-secondary li {
  margin: 0.75rem 0;
  overflow: hidden;
}

.menu-secondary a {
  display: inline-block;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 1.25rem;
  font-weight: 300;
  letter-spacing: 0.05em;
  transition: color 0.2s ease, transform 0.4s ease;
  transform: translateY(100%);
  opacity: 0;
  position: relative;
}

.menu-secondary a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: #fff;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s ease;
}

.menu-secondary a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

body.menu-open .menu-secondary a {
  transform: translateY(0);
  opacity: 1;
}

.menu-secondary li:nth-child(1) a { transition-delay: 0.15s; }
.menu-secondary li:nth-child(2) a { transition-delay: 0.2s; }
.menu-secondary li:nth-child(3) a { transition-delay: 0.25s; }

.menu-secondary a:hover {
  color: #fff;
}

.menu-social {
  display: flex;
  gap: 1.5rem;
  margin-top: 3rem;
  transform: translateY(20px);
  opacity: 0;
  transition: transform 0.4s ease 0.35s, opacity 0.4s ease 0.35s;
}

body.menu-open .menu-social {
  transform: translateY(0);
  opacity: 1;
}

.menu-social a {
  color: rgba(255, 255, 255, 0.55);
  text-decoration: none;
  transition: color 0.2s ease;
  display: flex;
  align-items: center;
}

.menu-social a:hover {
  color: #fff;
}

.menu-social svg {
  width: 20px;
  height: 20px;
}

/* ========================================
   Responsive - Menu
   ======================================== */
@media (max-width: 1024px) {
  .menu-content {
    gap: 4rem;
    padding: 0 3rem;
  }

  .menu-nav a {
    font-size: 1.75rem;
  }
}

@media (max-width: 768px) {
  :root {
    --header-height: 4.3rem;
  }

  header {
    padding: 1.5rem;
  }

  .breadcrumb {
    display: none;
  }

  body.menu-open header {
    background: #111;
  }

  .menu-content {
    grid-template-columns: 1fr;
    gap: 2rem;
    text-align: left;
    padding: 5rem 2rem 0;
    max-width: 400px;
  }

  .menu-col:first-child,
  .menu-col:last-child {
    text-align: left;
    justify-content: flex-start;
    padding-bottom: 0;
  }

  .menu-label {
    margin-bottom: 1rem;
  }

  .menu-nav li {
    margin: 0.5rem 0;
  }

  .menu-nav a {
    font-size: 1.75rem;
  }

  .menu-secondary li {
    margin: 0.5rem 0;
  }

  .menu-secondary a {
    font-size: 1.35rem;
  }

  .menu-social {
    margin-top: 1.5rem;
  }
}

/* Mobile landscape */
@media (max-height: 500px) and (orientation: landscape) {
  .menu-content {
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    padding: 4rem 3rem 2rem;
  }

  .menu-label {
    margin-bottom: 0.75rem;
  }

  .menu-nav li,
  .menu-secondary li {
    margin: 0.35rem 0;
  }

  .menu-nav a {
    font-size: 1.5rem;
  }

  .menu-secondary a {
    font-size: 1.1rem;
  }

  .menu-social {
    margin-top: 1rem;
  }
}

/* ========================================
   Common Page Styles
   ======================================== */
.breadcrumb {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #737373;
  margin-right: auto;
  margin-left: 2rem;
}

body.menu-open .breadcrumb {
  display: none;
}

.breadcrumb a {
  color: #737373;
  text-decoration: none;
  position: relative;
}

.breadcrumb a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 1px;
  background: #1a1a2e;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s ease;
}

.breadcrumb a:hover {
  color: #1a1a2e;
}

.breadcrumb a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* Dark theme breadcrumb */
body.theme-dark .breadcrumb {
  color: rgba(255, 255, 255, 0.6);
}

body.theme-dark .breadcrumb a {
  color: rgba(255, 255, 255, 0.6);
}

body.theme-dark .breadcrumb a::after {
  background: #fff;
}

body.theme-dark .breadcrumb a:hover {
  color: #fff;
}


/* ========================================
   More Work Section
   ======================================== */
.more-work {
  background: var(--bg-color);
  padding: 2rem 0;
  margin-top: 2rem;
  border-top: 1px solid var(--border-color, rgba(0, 0, 0, 0.1));
}

.more-work-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 4rem;
  text-align: left;
}

.more-work-label {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted, rgba(0, 0, 0, 0.55));
  margin-bottom: 0.75rem;
}

.more-work-link {
  display: inline-block;
  text-decoration: none;
  color: var(--text-color);
}

.more-work-title {
  font-size: 2rem;
  font-weight: 300;
  letter-spacing: 0.02em;
  margin-bottom: 0.5rem;
  position: relative;
  display: inline-block;
}

.more-work-title::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 1px;
  background: var(--text-color);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s ease;
}

.more-work-link:hover .more-work-title::after {
  transform: scaleX(1);
  transform-origin: left;
}

@media (max-width: 768px) {
  .more-work {
    padding: 2rem 0;
  }

  .more-work-inner {
    padding: 0 1.5rem;
  }

  .more-work-title {
    font-size: 1.5rem;
  }
}

/* ========================================
   Screen Reader Only
   ======================================== */

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

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

.site-footer {
  padding: 2rem 3rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-nav {
  display: flex;
  gap: 2rem;
}

.footer-nav a {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.65);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-nav a:hover {
  color: var(--text-color);
}

.footer-copy {
  font-size: 0.7rem;
  color: rgba(0, 0, 0, 0.55);
}

body.theme-dark .site-footer {
  border-top-color: rgba(255, 255, 255, 0.1);
}

body.theme-dark .footer-nav a {
  color: rgba(255, 255, 255, 0.6);
}

body.theme-dark .footer-nav a:hover {
  color: #fff;
}

body.theme-dark .footer-copy {
  color: rgba(255, 255, 255, 0.25);
}

@media (max-width: 768px) {
  .site-footer {
    padding: 1.5rem;
  }

  .footer-inner {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
}
