/* SJC Ceramics — shared styles */

:root {
  --bg: #f6f1ea;          /* warm cream */
  --surface: #fffdf9;
  --text: #3b2f27;        /* dark clay brown */
  --muted: #7a6a5e;
  --accent: #a85a36;      /* terracotta */
  --accent-dark: #8a4527;
  --border: #e3d8cb;
  --shadow: 0 2px 10px rgba(59, 47, 39, 0.08);
  --shadow-lift: 0 8px 24px rgba(59, 47, 39, 0.16);
  --radius: 10px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

a { color: var(--accent); }
a:hover { color: var(--accent-dark); }

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

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

main { flex: 1; }

/* ---------- Banner (home) ---------- */

.banner {
  text-align: center;
  padding: 3rem 1rem 1.5rem;
}

.banner h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2.4rem, 6vw, 3.8rem);
  letter-spacing: 0.04em;
  margin: 0;
}

.banner .subhead {
  font-family: var(--serif);
  font-style: italic;
  color: var(--muted);
  font-size: clamp(1.05rem, 2.4vw, 1.35rem);
  margin: 0.35rem 0 0;
}

.banner .rule {
  width: 64px;
  height: 2px;
  background: var(--accent);
  border: 0;
  margin: 1.25rem auto 0;
}

/* ---------- Page header (inner pages) ---------- */

.page-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.page-header .container {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.site-name {
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text);
  text-decoration: none;
}
.site-name:hover { color: var(--accent); }

.page-title {
  font-family: var(--serif);
  font-size: clamp(1.7rem, 4vw, 2.3rem);
  font-weight: 600;
  margin: 1.75rem 0 1rem;
}

/* ---------- Featured photo (home) ---------- */

.featured {
  max-width: 640px;
  margin: 1.5rem auto 2.5rem;
}

.featured img {
  width: auto;
  max-width: 100%;
  max-height: 45vh;          /* no taller than 65% of the screen */
  margin: 0 auto;            /* center it */
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.featured .photo-placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* Shown when an image file is missing */
.photo-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem;
  background: repeating-linear-gradient(45deg, #efe6db, #efe6db 12px, #f4ece2 12px, #f4ece2 24px);
  color: var(--muted);
  border: 2px dashed var(--border);
  font-size: 0.95rem;
}

/* ---------- Home tiles ---------- */

.tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  max-width: 900px;
  margin: 0 auto 3rem;
}

.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 1.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--text);
  text-decoration: none;
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 600;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.tile svg {
  width: 36px;
  height: 36px;
  stroke: var(--accent);
  transition: transform 0.18s ease;
}

.tile:hover,
.tile:focus-visible {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lift);
  border-color: var(--accent);
  color: var(--accent-dark);
}
.tile:hover svg { transform: scale(1.08); }
.tile:active { transform: translateY(-1px); }

/* ---------- About ---------- */

.about {
  display: grid;
  grid-template-columns: minmax(220px, 340px) 1fr;
  gap: 2.5rem;
  align-items: start;
  margin-bottom: 2rem;
}

.about .portrait img,
.about .portrait .photo-placeholder {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.statement p { margin: 0 0 1.1rem; font-size: 1.06rem; }
.statement p:first-child { font-family: var(--serif); font-size: 1.25rem; }

/* ---------- Gallery ---------- */

.gallery-scroll {
  /* The gallery scrolls inside this box instead of the page scrolling */
  height: calc(100vh - 290px);
  height: calc(100dvh - 290px);
  min-height: 320px;
  overflow-y: auto;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 4px rgba(59, 47, 39, 0.06);
  overscroll-behavior: contain;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.gallery-item {
  position: relative;
  margin: 0;
  border-radius: 8px;
  overflow: hidden;
  background: #efe6db;
  aspect-ratio: 1 / 1;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: zoom-in;
  transition: transform 0.3s ease;
}
.gallery-item:hover img { transform: scale(1.03); }

.gallery-item.broken img { visibility: hidden; }

.gallery-item.broken::after {
  content: "Photo unavailable";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Expand / collapse icon buttons share one look and the same corner */
.icon-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 253, 249, 0.92);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { background: var(--accent); color: #fff; transform: scale(1.08); }

.gallery-status {
  text-align: center;
  color: var(--muted);
  padding: 3rem 1rem;
}

/* Expanded view */
.viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(38, 30, 24, 0.86);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.viewer[hidden] { display: none; }
.viewer.open { opacity: 1; }

.viewer-card {
  position: relative;
  max-width: min(1000px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.viewer-card img {
  width: auto;
  max-width: 100%;
  max-height: calc(100vh - 160px);
  max-height: calc(100dvh - 160px);
  object-fit: contain;
  background: #2a221c;
  margin: 0 auto;
}

.viewer-caption {
  padding: 0.9rem 1.2rem 1rem;
  font-family: var(--serif);
  font-size: 1.15rem;
  text-align: center;
  border-top: 1px solid var(--border);
}

/* ---------- Contact ---------- */

.contact-form {
  max-width: 620px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem;
  margin-bottom: 2rem;
}

.field { margin-bottom: 1.1rem; }

.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.field .hint { font-weight: 400; color: var(--muted); font-size: 0.9rem; }

.field input,
.field textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  font: inherit;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.field textarea { min-height: 160px; resize: vertical; }

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(168, 90, 54, 0.18);
}

/* Honeypot field: hidden from people, visible to spam bots */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.form-actions { display: flex; gap: 0.75rem; justify-content: flex-end; }

.btn {
  font: inherit;
  font-weight: 600;
  padding: 0.65rem 1.4rem;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--accent);
  transition: background 0.15s ease, color 0.15s ease;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary { background: transparent; color: var(--accent); }
.btn-secondary:hover { background: rgba(168, 90, 54, 0.08); }
.btn:disabled { opacity: 0.6; cursor: wait; }

.form-status { margin: 1rem 0 0; min-height: 1.6em; font-weight: 600; }
.form-status.success { color: #4f7a4a; }
.form-status.error { color: #b03a2e; }

/* ---------- Footer link ---------- */

.home-link {
  text-align: center;
  padding: 1.25rem 1rem 2rem;
}
.home-link a {
  font-weight: 600;
  text-decoration: none;
}
.home-link a:hover { text-decoration: underline; }

/* ---------- Phones ---------- */

@media (max-width: 640px) {
  .banner { padding-top: 2rem; }
  .tiles { grid-template-columns: 1fr; gap: 0.9rem; }
  .tile { flex-direction: row; padding: 1.1rem; font-size: 1.2rem; }
  .tile svg { width: 28px; height: 28px; }

  .about { grid-template-columns: 1fr; gap: 1.5rem; }
  .about .portrait { max-width: 320px; margin: 0 auto; width: 100%; }

  .gallery-scroll {
    height: calc(100vh - 240px);
    height: calc(100dvh - 240px);
    padding: 0.75rem;
  }
  .gallery-grid { grid-template-columns: 1fr; }

  .contact-form { padding: 1.25rem; }
  .form-actions .btn { flex: 1; }

  .viewer { padding: 0.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
