:root {
  --paper:        #f4eee2;
  --paper-deep:   #ebe2cf;
  --ink:          #2a2620;
  --ink-soft:     #5a5246;
  --accent:       #8a3a2b;     /* deep terracotta */
  --accent-soft:  #c8826b;
  --rule:         #d8ccb1;
  --ok:           #3f6a3a;
  --err:          #a3372a;
  --shadow:       0 1px 1px rgba(0,0,0,.05), 0 6px 18px -6px rgba(50,40,20,.25);

  --display:      'Fraunces', Georgia, 'Times New Roman', serif;
  --body:         'Source Serif 4', Georgia, serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.55;
}

body {
  background-image:
    radial-gradient(circle at 20% 0%, rgba(255,255,255,.4), transparent 60%),
    radial-gradient(circle at 80% 100%, rgba(0,0,0,.04), transparent 60%);
  min-height: 100vh;
}

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

h1, h2 {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin: 0 0 .35em;
}
h1 { font-size: 2.1rem; font-variation-settings: 'opsz' 100; }
h2 { font-size: 1.35rem; }

.muted     { color: var(--ink-soft); }
.small     { font-size: 0.85em; }
.empty     { color: var(--ink-soft); padding: 2rem 0; }
.lede      { color: var(--ink-soft); font-size: 1.05em; max-width: 50ch; }
.crumbs    { font-size: 0.9em; color: var(--ink-soft); margin: 0 0 0.5em; }
.crumbs a  { color: var(--ink-soft); }

/* ---- Header & layout ---- */

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}
.brand {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; color: var(--accent); }
.site-nav { display: flex; gap: 1rem; align-items: baseline; }
.site-nav .who { color: var(--ink-soft); }

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 2rem;
}

.site-footer {
  border-top: 1px solid var(--rule);
  padding: 2rem;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.9em;
}

/* ---- Buttons ---- */

.btn {
  font-family: var(--body);
  font-size: 0.95rem;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  padding: 0.55rem 1.1rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--paper-deep); border-color: var(--ink-soft); }
.btn-primary {
  background: var(--accent);
  color: #fff8ec;
  border-color: var(--accent);
}
.btn-primary:hover { background: #6f2e22; border-color: #6f2e22; }
.btn-ghost { background: transparent; }

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font: inherit;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
}

/* ---- Forms ---- */

.card { max-width: 28rem; }
.form { display: flex; flex-direction: column; gap: 0.85rem; }
.form label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.9rem; color: var(--ink-soft); }
.form label.checkbox { flex-direction: row; align-items: center; gap: 0.5rem; color: var(--ink); }
.form input[type=text], .form input[type=password], .form input:not([type]), .form input[type=file], .form textarea {
  font-family: var(--body);
  font-size: 1rem;
  color: var(--ink);
  padding: 0.55rem 0.7rem;
  background: #fffaf0;
  border: 1px solid var(--rule);
  border-radius: 3px;
  width: 100%;
}
.form input:focus, .form textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
}
.form .inline { display: inline; }

.modal {
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  padding: 1.5rem 1.75rem;
  box-shadow: var(--shadow);
  max-width: 32rem;
}
.modal::backdrop { background: rgba(40, 30, 20, 0.45); }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.5rem; }

/* ---- Flash ---- */

.flash {
  padding: 0.75rem 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  border: 1px solid var(--rule);
}
.flash-ok  { border-color: var(--ok);  background: #ecf3e9; color: var(--ok); }
.flash-err { border-color: var(--err); background: #f7e6e3; color: var(--err); }

/* ---- Albums grid ---- */

.album-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 2rem;
}
.album-card a {
  display: block;
  color: inherit;
  text-decoration: none;
}
.album-cover {
  aspect-ratio: 4/3;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform .15s ease;
}
.album-card a:hover .album-cover { transform: translateY(-2px); }
.album-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.album-cover-empty { width: 100%; height: 100%; }
.album-meta { margin-top: 0.75rem; }
.album-meta h2 { margin: 0; font-size: 1.15rem; }
.album-desc { color: var(--ink-soft); font-size: 0.92em; margin: 0.3rem 0 0; }

/* ---- Photo grid ---- */

.photo-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.5rem;
}
.photo-card a {
  display: block;
  color: inherit;
}
.photo-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  box-shadow: var(--shadow);
  transition: transform .15s ease;
}
.photo-card a:hover img { transform: translateY(-2px); }
.photo-caption-snippet {
  margin-top: 0.4rem;
  font-size: 0.88em;
  color: var(--ink-soft);
}

/* ---- Single photo ---- */

.photo-stage {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 1.5rem;
}
.photo-main {
  max-width: 100%;
  max-height: 75vh;
  height: auto;
  width: auto;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  box-shadow: var(--shadow);
}
.nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 2.4rem;
  font-family: var(--display);
  color: var(--ink-soft);
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(244, 238, 226, 0.85);
  border-radius: 50%;
  text-decoration: none;
}
.nav-arrow:hover { color: var(--accent); text-decoration: none; }
.nav-prev { left: 0.5rem; }
.nav-next { right: 0.5rem; }

.caption-area {
  max-width: 60ch;
  margin: 0 auto;
}
.caption-form { gap: 0.5rem; }
.caption-text {
  font-size: 1.1rem;
  font-style: italic;
  color: var(--ink);
  border-left: 3px solid var(--accent-soft);
  padding-left: 1rem;
}

/* ---- User table ---- */

.user-table {
  width: 100%;
  border-collapse: collapse;
}
.user-table th, .user-table td {
  text-align: left;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--rule);
}
.user-table th {
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink-soft);
}
