/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

 /* app/assets/stylesheets/application.css */

/* 1. Global Reset & Minimalist Variables */
:root {
  /* Minimalist Gallery Palette */
  --bg-color: #ffffff; /* Pure white gallery wall */
  --surface-color: #f9f9f9; /* Just a hint of gray for secondary sections */
  
  /* Text Colors - Charcoal instead of pure black is easier on the eyes */
  --text-main: #2c2c2c; 
  --text-muted: #888888;
  
  /* Accent Color - A soft, organic color used very sparingly (e.g., links) */
  --accent-color: #d4a373; 
  
  /* Soft UI Elements */
  --border-light: 1px solid #eaeaea;
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.05);
  --border-radius: 4px; /* Very subtle rounding */
}

/* Base Body Styles */
body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; /* Clean, classic sans-serif */
  line-height: 1.6;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased; /* Makes text look sharper and thinner on Mac */

  /* Page shell: the footer sits at the bottom even on short pages */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
}

/* 2. Gallery Button Base */
.btn-gallery {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 28px;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 1px; /* Tracking out the letters adds elegance */
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  
  color: var(--text-main);
  background-color: transparent;
  border: 1px solid var(--text-main);
  border-radius: 50px; /* Pill shape for an organic, smooth feel */
  
  transition: all 0.3s ease; /* Slower, smoother transition */
}

/* 3. The Refined Hover State */
.btn-gallery:hover, .btn-gallery:focus {
  background-color: var(--text-main);
  color: var(--bg-color); /* Swaps text to white */
  outline: none;
}

/* =========================================
   Minimalist Navigation Header
   ========================================= */

.gallery-header {
  /* Three equal-width columns keep the nav centred regardless of what sits either side */
  display: grid;
  /* minmax(0, 1fr) lets the side columns shrink below their content so the
     header never pushes the page wider than the viewport */
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  padding: 12px 40px; /* 12px top/bottom + the 56px logo box = an 80px header; 40px sides match the page content */
  background-color: rgba(255, 255, 255, 0.95); /* Slight transparency */
  backdrop-filter: blur(5px); /* Blurs the artwork as it scrolls behind the header */
  
  position: sticky;
  top: 0;
  z-index: 100;
  /* We removed the bottom border completely for a cleaner look */
}

.header-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

/* Social icon link on the right of the header */
.header-social {
  display: inline-flex;
  align-items: center;
  color: var(--text-main);
  transition: color 0.2s ease;
}

.header-social:hover,
.header-social:focus {
  color: var(--accent-color);
  outline: none;
}

/* Delicate Navigation Links */
.nav-links {
  display: flex;
  gap: 40px; /* Lots of space between links */
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  font-size: 0.9rem;
  font-weight: 400;
  text-decoration: none;
  color: var(--text-main);
  transition: color 0.2s ease;
}

.nav-links a:hover {
  color: var(--accent-color); /* A subtle color shift, no background blocks */
}

/* =========================================
   Logo Cropping & Zooming
   ========================================= */

/* 1. The Cropping Container (The physical space in your header) */
.header-logo .logo-crop {
  display: block;
  height: 56px;  /* The exact height you want in the navbar */
  width: 140px;  /* Adjust this based on your logo's width */
  overflow: hidden; /* The scissors that cut off the excess */
}

/* 2. The Telescope Zoom */
.header-logo .logo-crop img {
  width: 100%;
  height: 100%;
  object-fit: contain; /* Ensures the whole image fits inside the box first */
  
  /* Interim fix until a tightly cropped header logo arrives from the designer.
     The artwork fills about half the PNG, so 1.8x makes it ~50px tall inside
     the 56px box. Anchoring to the left and shifting by the PNG's left margin
     (18% of the 56px box, times 1.8) puts the artwork on the page's content edge. */
  object-position: left center;
  transform: translateX(-18px) scale(1.8);
  transform-origin: left center;
}

/* =========================================
   Minimalist Portfolio Grid (CSS Grid)
   ========================================= */

.gallery-container {
  max-width: 1400px; /* Keep it from stretching endlessly on massive monitors */
  margin: 60px auto; /* Centers the grid and adds breathing room below the header */
  padding: 0 40px;
}

.portfolio-grid {
  display: grid;
  /* 
    This is the magic line. It creates columns that are AT LEAST 300px wide, 
    but will automatically stretch (1fr) to fill remaining space. 
    It auto-wraps based on screen size!
  */
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  
  /* We set a fixed height for our standard rows to anchor the masonry math */
  grid-auto-rows: 350px; 
  gap: 24px; /* The clean, consistent white space between paintings */
}

/* Base Item Styling (a tile may be a link or a plain block) */
.portfolio-item {
  display: block;
  text-decoration: none;
  position: relative; /* Needed so the overlay sits on top */
  overflow: hidden; /* Ensures the image doesn't break out when zoomed */
  border-radius: var(--border-radius); /* That subtle 4px rounding from our variables */
  background-color: var(--surface-color);
}

/* Image Handling */
.portfolio-item img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Absolutely crucial: crops the image gracefully instead of squishing */
  transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94); /* Smooth, premium zoom */
}

/* --- The Masonry Utility Classes --- */
.span-tall {
  grid-row: span 2; /* Takes up two 350px rows + the gap */
}

.span-wide {
  grid-column: span 2; /* Takes up two columns */
}

/* The Text Overlay */
.portfolio-item .overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255, 255, 255, 0.85); /* Milky white semi-transparent veil */
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0; /* Hidden by default */
  transition: opacity 0.4s ease;
}

.portfolio-item .overlay span {
  color: var(--text-main);
  font-size: 1.2rem;
  font-weight: 300;
  letter-spacing: 2px;
  text-transform: uppercase;
  transform: translateY(15px); /* Start slightly low */
  transition: transform 0.4s ease;
}

/* The Hover Triggers */
.portfolio-item:hover img {
  transform: scale(1.05); /* Gentle zoom on the artwork */
}

.portfolio-item:hover .overlay {
  opacity: 1; /* Fade in the veil */
}

.portfolio-item:hover .overlay span {
  transform: translateY(0); /* Slide the text up into place */
}
/* =========================================
   Hero (home page)
   ========================================= */

.hero {
  max-width: 1400px;
  margin: 40px auto 0;
  padding: 0 40px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
  min-height: 70vh; /* Leaves the top of the grid peeking in below */
}

.hero-image {
  border-radius: var(--border-radius);
  overflow: hidden;
  background-color: var(--surface-color);
  aspect-ratio: 4 / 5;
}

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

.hero-text h1 {
  font-size: 2.2rem;
  font-weight: 300;
  line-height: 1.25;
  margin: 0 0 16px;
}

.hero-text p {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 48ch;
  margin: 0 0 28px;
}

/* =========================================
   Page intro (portfolio heading, product title and story)
   ========================================= */

.page-intro {
  max-width: 760px;
  margin: 56px auto 0;
  padding: 0 40px;
  text-align: center;
}

.page-intro h1 {
  font-size: 2rem;
  font-weight: 300;
  letter-spacing: 1px;
  margin: 0 0 12px;
}

.page-intro p {
  color: var(--text-muted);
  margin: 0 0 1em;
}

/* The about page: longer copy, so it reads left-aligned under a centred title */
.page-intro.about p {
  text-align: left;
  font-size: 1.05rem;
  line-height: 1.7;
}

.page-intro.about h2 {
  font-size: 1.3rem;
  font-weight: 300;
  letter-spacing: 1px;
  margin: 40px 0 12px;
}

.page-intro.about a {
  color: var(--text-main);
}

.page-intro.about a:hover {
  color: var(--accent-color);
}

.page-intro .back-link {
  display: inline-block;
  margin-bottom: 20px;
  font-size: 0.85rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text-muted);
}

.page-intro .back-link:hover {
  color: var(--accent-color);
}

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

.site-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 48px 24px 32px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer-social {
  display: flex;
  gap: 20px;
}

.footer-social a {
  display: inline-flex;
  color: var(--text-main);
  transition: color 0.2s ease;
}

.footer-social a:hover,
.footer-social a:focus {
  color: var(--accent-color);
  outline: none;
}

.footer-copyright {
  margin: 0;
}

/* =========================================
   Narrow screens
   ========================================= */

@media (max-width: 800px) {
  .gallery-header {
    padding-left: 20px;
    padding-right: 20px;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 28px;
    min-height: 0;
    padding: 0 20px;
  }

  .hero-text h1 {
    font-size: 1.6rem;
  }

  .gallery-container,
  .page-intro {
    padding: 0 20px;
  }
}

/* Phones: keep the header on one row by shrinking the logo box and nav gaps.
   At 375px that leaves room to spare: 72px logo + ~160px nav + 22px icon
   inside the 335px between the 20px paddings. */
@media (max-width: 600px) {
  .header-logo .logo-crop {
    width: 72px; /* Just the artwork; the crop box's spare width is not needed here */
  }

  .nav-links {
    gap: 16px;
  }

  .nav-links a {
    font-size: 0.85rem;
  }
}
