/* Le Tiroir à Photos — mobile-first stylesheet.
   Base styles target phones; wider screens are adjusted in @media blocks. */

:root {
  --ink: #2b2320;        /* main text */
  --paper: #faf6f1;      /* page background, warm paper tone */
  --accent: #8c5a3c;     /* wood-drawer brown */
  --muted: #7a6f68;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
}

.site-header {
  background: var(--accent);
  padding: 0.75rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.site-header h1 {
  margin: 0;
  font-size: 1.25rem;
}

.site-header a {
  color: #fff;
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: 1rem;
  font-size: 0.95rem;
}

.header-search {
  flex-basis: 100%;
  margin-top: 0.4rem;
}

.header-search input {
  width: 100%;
  max-width: 22rem;
  font-size: 1rem;
  padding: 0.4rem 0.7rem;
  border: none;
  border-radius: 0.4rem;
}

.search-page-form {
  display: flex;
  gap: 0.5rem;
  max-width: 28rem;
}

.search-page-form input {
  flex: 1;
  font-size: 1rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid #cbbfb4;
  border-radius: 0.4rem;
  background: #fff;
}

.search-page-form button {
  font-size: 1rem;
  padding: 0.55rem 1rem;
  border: none;
  border-radius: 0.4rem;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

.site-nav .whoami { color: #f3e4d7; text-decoration: underline dotted; }

.flash {
  background: #fdf0d5;
  border: 1px solid #e5c88b;
  border-radius: 0.5rem;
  padding: 0.6rem 1rem;
}

/* Forms: one field per line, comfortable on a phone keyboard. */
.stacked-form {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-width: 24rem;
}

.stacked-form label { margin-top: 0.6rem; font-weight: 600; }

.stacked-form input {
  font-size: 1rem;          /* prevents auto-zoom on iPhone */
  padding: 0.55rem 0.7rem;
  border: 1px solid #cbbfb4;
  border-radius: 0.4rem;
  background: #fff;
}

.stacked-form button {
  margin-top: 1rem;
  font-size: 1rem;
  padding: 0.6rem 1rem;
  border: none;
  border-radius: 0.4rem;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

.data-table {
  border-collapse: collapse;
  width: 100%;
}

.data-table th, .data-table td {
  text-align: left;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid #e5dcd3;
}

.invitation-list li { margin-bottom: 0.75rem; }

/* Prominent action link styled as a button */
a.button {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  padding: 0.6rem 1rem;
  border-radius: 0.4rem;
}

/* Photo grid: 3 columns on phones, more on wider screens. */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
}

.photo-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;   /* square crop in the grid only, files untouched */
  border-radius: 0.3rem;
  display: block;
}

@media (min-width: 40rem) {
  .photo-grid { grid-template-columns: repeat(5, 1fr); }
}

/* Upload page */
.file-label input[type="file"] { margin-top: 0.3rem; }

.upload-list {
  list-style: none;
  padding: 0;
  max-width: 32rem;
}

.upload-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.2rem 0.75rem;
  align-items: center;
  padding: 0.4rem 0;
  border-bottom: 1px solid #e5dcd3;
}

.upload-list progress { width: 100%; grid-column: 1; }

.upload-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-ok .upload-status { color: #2e7d32; }
.upload-failed .upload-status { color: #b3261e; font-size: 0.85rem; }

/* Photo detail page */
.photo-view {
  max-width: 100%;
  height: auto;
  border-radius: 0.4rem;
  display: block;
}

/* Pointing: the photo sits in a "stage" that hosts the invisible frames. */
.photo-stage {
  position: relative;
  display: inline-block;
  max-width: 100%;
  line-height: 0;
}

.region {
  position: absolute;
  border: 2px solid rgba(255, 255, 255, 0.95);
  outline: 1px solid rgba(0, 0, 0, 0.55);
  border-radius: 4px;
  opacity: 0;                 /* invisible by default: no visual clutter */
  transition: opacity 0.15s;
}

.region:hover,
.photo-stage.show-all .region,
.region.highlight { opacity: 1; }

.region-label {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 3px;
  background: rgba(43, 35, 32, 0.85);
  color: #fff;
  padding: 0.05rem 0.45rem;
  border-radius: 0.3rem;
  font-size: 0.8rem;
  line-height: 1.4;
  white-space: nowrap;
}

.photo-stage.pointing {
  cursor: crosshair;
  touch-action: none;          /* finger drags draw instead of scrolling */
  user-select: none;
}

.photo-stage.pointing .region { opacity: 0.25; pointer-events: none; }

#temp-rect {
  position: absolute;
  border: 2px dashed #fff;
  outline: 1px solid rgba(0, 0, 0, 0.6);
  background: rgba(255, 255, 255, 0.15);
  pointer-events: none;
}

.pointing-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  background: #fdf0d5;
  border: 1px solid #e5c88b;
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  margin: 0.5rem 0;
}

.pointing-banner button {
  font-size: 0.95rem;
  padding: 0.35rem 0.8rem;
  border: none;
  border-radius: 0.4rem;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

.pointing-banner button.danger-text { background: #b3261e; }

/* Albums */
.chip-album { background: #e9e2f4; }

.album-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin: 1rem 0;
}

@media (min-width: 40rem) {
  .album-grid { grid-template-columns: repeat(4, 1fr); }
}

.album-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  text-decoration: none;
  color: inherit;
  background: #fff;
  border: 1px solid #e5dcd3;
  border-radius: 0.6rem;
  padding: 0.6rem;
}

.album-card img, .album-cover-empty {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 0.4rem;
}

.album-cover-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #efe9e2;
  color: var(--muted);
}

.album-thumb { position: relative; }

.album-thumb-actions {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  display: flex;
  gap: 0.25rem;
}

.thumb-btn {
  border: none;
  cursor: pointer;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  color: #4a4340;
  font-size: 0.95rem;
  line-height: 1;
}

/* Timeline */
.timeline {
  position: relative;
  margin: 1.25rem 0 1.25rem 0.4rem;
  padding-left: 1.6rem;
  border-left: 3px solid var(--accent);
}

.timeline-year { margin-bottom: 1.75rem; }

.timeline-year h3 {
  position: relative;
  margin: 0 0 0.6rem;
}

.timeline-year h3::before {
  content: "";
  position: absolute;
  left: -2.15rem;
  top: 0.35rem;
  width: 0.85rem;
  height: 0.85rem;
  background: var(--accent);
  border: 2px solid var(--paper);
  border-radius: 50%;
}

.timeline-count { font-size: 0.85rem; font-weight: normal; }

.link-like {
  border: none;
  background: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.95rem;
  padding: 0;
}

.photo-caption { font-size: 1.1rem; }

.photo-edit {
  margin-top: 1rem;
  border: 1px solid #e5dcd3;
  border-radius: 0.5rem;
  padding: 0.6rem 1rem;
  background: #fff;
}

.photo-edit summary { cursor: pointer; font-weight: 600; }

.photo-edit select {
  font-size: 1rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid #cbbfb4;
  border-radius: 0.4rem;
  background: #fff;
}

.danger-zone {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px dashed #cbbfb4;
}

button.danger { background: #b3261e; }

.pagination {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin: 1.25rem 0;
}

/* Tag chips, colored by category */
.chips { line-height: 2.6; margin: 0.75rem 0; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border-radius: 1.2rem;
  padding: 0.35rem 0.9rem;
  margin-right: 0.45rem;
  background: #eee;
  white-space: nowrap;
  font-size: 1.05rem;
}

.chip a { color: inherit; text-decoration: none; }

/* Round action buttons inside a chip (◎ point, × remove) */
.chip-btn {
  border: none;
  cursor: pointer;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.75);
  color: #4a4340;
  font-size: 1.1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.chip-btn:hover { background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); }

.chip-person { background: #dbe7f6; }
.chip-place  { background: #dcefdc; }
.chip-event  { background: #f6e7db; }
.chip-other  { background: #ece9e6; }

.chip-count {
  background: rgba(0, 0, 0, 0.08);
  border-radius: 1rem;
  padding: 0 0.45rem;
  font-size: 0.8rem;
}

.chip-remove { display: inline-flex; }

/* Tag add form with suggestions dropdown */
.tag-add {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.tag-add input, .tag-add select {
  font-size: 1rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid #cbbfb4;
  border-radius: 0.4rem;
  background: #fff;
}

.tag-add button {
  font-size: 1rem;
  padding: 0.55rem 1rem;
  border: none;
  border-radius: 0.4rem;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

.tag-input-wrap { position: relative; }

.tag-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 10;
  background: #fff;
  border: 1px solid #cbbfb4;
  border-radius: 0.4rem;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
}

.tag-suggestion {
  border: none;
  text-align: left;
  padding: 0.5rem 0.7rem;
  cursor: pointer;
  font-size: 1rem;
}

.tag-suggestion:hover { filter: brightness(0.95); }

/* Comments */
.comments-block { margin-top: 1.5rem; }

.comment {
  background: #fff;
  border: 1px solid #e5dcd3;
  border-radius: 0.5rem;
  padding: 0.6rem 1rem;
  margin-bottom: 0.6rem;
}

.comment-meta { margin: 0 0 0.3rem; }

.comment-content { margin: 0; white-space: pre-line; }

.comment-actions {
  margin: 0.4rem 0 0;
  display: flex;
  gap: 1rem;
  align-items: baseline;
  font-size: 0.9rem;
}

.comment-edit summary { cursor: pointer; color: var(--accent); }

.inline-form { display: inline; }

.link-button {
  border: none;
  background: none;
  color: #b3261e;
  cursor: pointer;
  padding: 0;
  font-size: 0.9rem;
}

.stacked-form textarea {
  font-size: 1rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid #cbbfb4;
  border-radius: 0.4rem;
  background: #fff;
  resize: vertical;
}

/* "Derniers commentaires" on the home page */
.home-comments .comment-meta {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.mini-thumb {
  width: 3rem;
  height: 3rem;
  object-fit: cover;
  border-radius: 0.3rem;
  display: block;
}

/* Home page cards (anniversaries, photo of the day) */
.card {
  background: #fff;
  border: 1px solid #e5dcd3;
  border-radius: 0.6rem;
  padding: 0.75rem 1.1rem;
  margin: 0.9rem 0;
}

.card h3 { margin: 0.2rem 0 0.5rem; }

.daily-card {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.daily-thumb {
  width: 6.5rem;
  height: 6.5rem;
  object-fit: cover;
  border-radius: 0.4rem;
  display: block;
}

.anniv-list li { margin-bottom: 0.5rem; }

/* Dashboard storage gauge */
.gauge {
  height: 1.1rem;
  background: #efe9e2;
  border: 1px solid #e5dcd3;
  border-radius: 0.6rem;
  overflow: hidden;
  margin: 0.5rem 0;
}

.gauge-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 0.6rem 0 0 0.6rem;
  min-width: 2px;
}

.gauge-warn { background: #b3261e; }

/* Home layout: single column on phones, two columns on wide screens. */
.home-top {
  display: grid;
  gap: 1rem;
  margin: 0.9rem 0;
}

.home-top .card { margin: 0; }

.home-main { margin: 0.5rem 0 1rem; }

@media (min-width: 64rem) {
  .home-top { grid-template-columns: 1fr 1fr; align-items: start; }

  .home-main {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    align-items: start;
  }

  .home-photos .photo-grid { grid-template-columns: repeat(4, 1fr); }

  .home-side {
    background: #fff;
    border: 1px solid #e5dcd3;
    border-radius: 0.6rem;
    padding: 0.25rem 1.1rem 0.75rem;
  }
}

.invitation-list code {
  display: inline-block;
  background: #fff;
  border: 1px solid #e5dcd3;
  border-radius: 0.3rem;
  padding: 0.2rem 0.4rem;
  word-break: break-all;
}

.content {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1rem;
}

.stats {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.stats li {
  background: #fff;
  border: 1px solid #e5dcd3;
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
}

.muted { color: var(--muted); font-size: 0.9rem; }

.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 1rem;
}

/* Screens wider than phones */
@media (min-width: 40rem) {
  .site-header h1 { font-size: 1.5rem; }
}
