:root {
  color-scheme: light;
  --bg: #f7f1ea;
  --bg-soft: #fffaf5;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-strong: #ffffff;
  --text: #2e221d;
  --muted: #7a685f;
  --accent: #a46b5f;
  --accent-strong: #7f4f45;
  --accent-soft: #ead4cb;
  --border: rgba(110, 80, 68, 0.16);
  --shadow: 0 18px 50px rgba(84, 54, 45, 0.12);
  --shadow-soft: 0 8px 24px rgba(84, 54, 45, 0.08);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }

html {
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.82), transparent 34%),
    radial-gradient(circle at 85% 10%, rgba(227, 197, 184, 0.4), transparent 24%),
    linear-gradient(180deg, #fdf8f3 0%, #f4ebe4 50%, #f7f1ea 100%);
  min-height: 100%;
}

body {
  margin: 0;
  padding: 24px;
  color: var(--text);
  font-family: "Avenir Next", "Gill Sans", "Trebuchet MS", sans-serif;
  line-height: 1.6;
  background: transparent;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.16) 1px, transparent 1px);
  background-size: 44px 44px;
  opacity: 0.22;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.62), transparent 92%);
}

body > * {
  position: relative;
  z-index: 1;
}

body > nav,
body > hr,
body > h1,
body > h2,
body > p,
body > section,
body > form,
body > .upload-box,
body > .feed,
body > .filters,
body > .card,
body > table,
body > div,
body > article {
  max-width: 1120px;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.35rem;
  align-items: center;
  padding: 0.95rem 1.1rem;
  margin: 0 auto 1rem;
  width: min(1120px, 100%);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 250, 245, 0.72);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-soft);
}

nav a {
  color: var(--accent-strong);
  text-decoration: none;
  font-weight: 650;
  border-radius: 999px;
  padding: 0.4rem 0.8rem;
  transition: transform 160ms ease, background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

nav a:hover {
  background: rgba(164, 107, 95, 0.12);
  transform: translateY(-1px);
}

nav .nav-item { color: var(--muted); }

hr {
  width: min(1120px, 100%);
  margin: 1.2rem auto 2rem;
  border: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(127, 79, 69, 0.22), transparent);
}

h1, h2, h3 {
  width: min(1120px, 100%);
  margin: 0 auto 0.85rem;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  color: var(--text);
  letter-spacing: 0.01em;
}

h1 {
  font-size: clamp(2.2rem, 5vw, 4rem);
  line-height: 1.04;
  text-wrap: balance;
}

h2 { font-size: clamp(1.4rem, 2.3vw, 2rem); }

p {
  width: min(1120px, 100%);
  margin: 0 auto 1rem;
  color: var(--muted);
  font-size: 1.05rem;
}

form, .upload-box, .card, .filters, .modal-panel, table {
  width: min(1120px, 100%);
}

.upload-box,
form,
section > .filters,
.card,
table,
#loginForm,
#profileForm {
  margin: 0 auto 1rem;
  padding: 1.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-soft);
}

label {
  color: var(--text);
  font-weight: 650;
}

input, select, button, textarea {
  font: inherit;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="file"],
select,
textarea {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.82rem 0.95rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(127, 79, 69, 0.18);
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(164, 107, 95, 0.58);
  box-shadow: 0 0 0 4px rgba(164, 107, 95, 0.14);
}

button {
  border: 0;
  border-radius: 999px;
  padding: 0.8rem 1.2rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(127, 79, 69, 0.18);
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(127, 79, 69, 0.22);
  filter: saturate(1.03);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.feed {
  width: min(1120px, 100%);
  margin: 0 auto;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.9rem;
}

.filters label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.card {
  overflow: hidden;
  background: rgba(255, 255, 255, 0.9);
}

.card img,
.photo-thumb {
  border-bottom: 1px solid rgba(127, 79, 69, 0.08);
}

.meta {
  background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(248,241,236,0.92));
}

.like-btn {
  width: 2.4rem;
  height: 2.4rem;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255,255,255,0.86);
  box-shadow: inset 0 0 0 1px rgba(127, 79, 69, 0.12);
}

.like-btn.liked {
  color: #cf5a57;
}

.like-count {
  min-width: 2ch;
  font-weight: 700;
}

.danger {
  background: linear-gradient(135deg, #c85f56, #8f2f2a);
}

.danger:hover {
  background: linear-gradient(135deg, #d86a61, #9c332e);
}

.modal {
  animation: fadeIn 180ms ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 720px) {
  body { padding: 14px; }
  nav {
    border-radius: 24px;
    justify-content: center;
  }
  h1 { font-size: clamp(2rem, 8vw, 3rem); }
  .upload-box,
  form,
  section > .filters,
  .card,
  table,
  #loginForm,
  #profileForm {
    border-radius: 22px;
  }
}