/* ==========================================================================
   Agathiar Weekly — magazine styles
   ========================================================================== */

:root {
  --paper: #f8f4ec;
  --paper-deep: #f1e9dc;
  --surface: #fffdf9;
  --ink: #241d18;
  --ink-soft: #5f554a;
  --muted: #8c8174;
  --maroon: #7c1f26;
  --maroon-deep: #5d141a;
  --maroon-soft: #f6e8e7;
  --gold: #b18a51;
  --line: #e4d9c9;
  --line-strong: #d8c9b5;
  --danger: #a62b2b;
  --shadow: 0 24px 60px -36px rgba(68, 34, 22, 0.38);
  --shadow-soft: 0 10px 30px -24px rgba(68, 34, 22, 0.42);
  --radius: 18px;
  --radius-sm: 12px;
  --serif: "Noto Serif Tamil", Georgia, "Times New Roman", serif;
  --sans: "Noto Sans Tamil", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --max: 1180px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 420px at 50% -180px, #fffdf9 0%, rgba(255, 253, 249, 0) 70%),
    var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

body.no-scroll {
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

img,
svg {
  display: block;
}

img {
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

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

button {
  cursor: pointer;
}

h1,
h2,
h3,
p {
  overflow-wrap: break-word;
}

::selection {
  background: var(--maroon);
  color: #fff;
}

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

.skip-link {
  position: absolute;
  left: 1rem;
  top: -5rem;
  z-index: 100;
  background: var(--maroon);
  color: #fff;
  padding: 0.7rem 1rem;
  border-radius: 8px;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 1rem;
}

.topline {
  height: 4px;
  background: linear-gradient(90deg, var(--maroon-deep), var(--gold), var(--maroon));
}

/* --------------------------------------------------------------------------
   Masthead
   -------------------------------------------------------------------------- */

.masthead {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(248, 244, 236, 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.masthead__inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.75rem 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
  text-decoration: none;
}

.brand__logo {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
  box-shadow:
    0 0 0 1px rgba(177, 138, 81, 0.55),
    0 0 0 4px rgba(255, 253, 249, 0.85);
}

.brand__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.brand__en {
  font-family: var(--serif);
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: 0.045em;
  white-space: nowrap;
}

.brand__ta {
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex: none;
}

.nav__link {
  border: 0;
  background: none;
  padding: 0.35rem 0;
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.nav__link:hover {
  color: var(--maroon);
}

.nav__link--muted {
  color: var(--muted);
}

.nav__button {
  border-left: 1px solid var(--line);
  padding-left: 0.9rem;
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero {
  max-width: 780px;
  margin: 0 auto;
  padding: 2.8rem 1.2rem 2.1rem;
  text-align: center;
}

.hero__eyebrow {
  margin: 0 0 0.9rem;
  color: var(--gold);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero__title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.85rem, 7vw, 3.2rem);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.3;
}

.hero__ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin: 1.15rem auto;
  width: 94px;
}

.hero__ornament::before,
.hero__ornament::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line-strong);
}

.hero__ornament span {
  width: 6px;
  height: 6px;
  background: var(--gold);
  transform: rotate(45deg);
}

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.02em;
}

.dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--line-strong);
}

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */

.magazine-layout {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.1rem 3.5rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;
}

.feed {
  min-width: 0;
}

/* --------------------------------------------------------------------------
   Timeline feed
   -------------------------------------------------------------------------- */

.timeline {
  position: relative;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 10px;
  bottom: 12px;
  width: 1px;
  background: var(--line-strong);
}

.day-group {
  position: relative;
  padding-left: 1.7rem;
  margin-bottom: 2.4rem;
}

.day-group:last-child {
  margin-bottom: 0;
}

.day-group__label {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
  margin: 0 0 0.9rem;
  min-height: 18px;
}

.day-group__label::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.28rem;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--maroon);
  box-shadow: 0 0 0 4px var(--paper);
}

.day-group__weekday {
  color: var(--maroon);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.day-group__date {
  color: var(--muted);
  font-size: 0.72rem;
}

.day-group__posts {
  display: grid;
  gap: 1.2rem;
}

/* --------------------------------------------------------------------------
   Post cards
   -------------------------------------------------------------------------- */

.post {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  transition:
    opacity 0.55s ease,
    transform 0.55s ease,
    box-shadow 0.3s ease;
}

.js .post {
  opacity: 0;
  transform: translateY(14px);
}

.js .post.is-visible {
  opacity: 1;
  transform: none;
}

.post:hover {
  box-shadow: var(--shadow);
}

.post__media {
  position: relative;
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--paper-deep);
  aspect-ratio: 16 / 10;
  overflow: hidden;
  cursor: pointer;
}

.post--photo .post__media {
  aspect-ratio: 4 / 3;
}

.post__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s cubic-bezier(0.2, 0.6, 0.2, 1);
}

.post:hover .post__media img {
  transform: scale(1.025);
}

.post__media iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.post__body {
  padding: 1.1rem 1.15rem 1.25rem;
}

.post__kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.6rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.55rem;
  border: 1px solid rgba(124, 31, 38, 0.18);
  border-radius: 999px;
  background: var(--maroon-soft);
  color: var(--maroon);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tag--photo {
  border-color: rgba(177, 138, 81, 0.3);
  background: #f8f0e2;
  color: #7a5a25;
}

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

.post__title {
  margin: 0 0 0.5rem;
  font-family: var(--serif);
  font-size: 1.32rem;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: -0.01em;
}

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

.post__title a:hover {
  color: var(--maroon);
}

.post__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 0.9rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 38px;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 600;
  transition:
    border-color 0.2s ease,
    color 0.2s ease,
    background 0.2s ease;
}

.share-btn:hover {
  border-color: var(--maroon);
  background: var(--maroon-soft);
  color: var(--maroon);
}

.share-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.post--featured .post__title {
  font-size: 1.55rem;
}

.post__desc {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
  margin: 0;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 0.93rem;
  line-height: 1.85;
  white-space: pre-line;
}

.post--featured .post__desc {
  -webkit-line-clamp: 6;
}

.video-play {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 253, 249, 0.92);
  color: var(--maroon);
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.5);
  transform: translate(-50%, -50%);
  transition: transform 0.25s ease, background 0.25s ease;
  pointer-events: none;
}

.video-play svg {
  width: 24px;
  height: 24px;
  margin-left: 3px;
  fill: currentColor;
}

.post__media:hover .video-play {
  transform: translate(-50%, -50%) scale(1.06);
  background: #fff;
}

.photo-count {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.32rem 0.6rem;
  border-radius: 999px;
  background: rgba(29, 22, 18, 0.68);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 500;
  backdrop-filter: blur(6px);
}

.photo-count svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
}

.feed__footer {
  padding: 2rem 0 0.5rem;
  text-align: center;
}

/* --------------------------------------------------------------------------
   States
   -------------------------------------------------------------------------- */

.state {
  padding: 1rem 0;
}

.state__loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  padding: 3rem 1rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--maroon);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.state__box {
  padding: 2.6rem 1.3rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
}

.state__logo {
  width: 58px;
  height: 58px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  opacity: 0.9;
}

.state__title {
  margin: 0 0 0.45rem;
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 600;
}

.state__text {
  margin: 0 auto 1.1rem;
  max-width: 34ch;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

/* --------------------------------------------------------------------------
   Advertisements
   -------------------------------------------------------------------------- */

.ad-rail {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  order: -1;
}

.ad-rail__label {
  margin: 0;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-align: center;
  text-transform: uppercase;
}

.ad-rail__list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
  gap: 0.9rem;
}

.ad-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.ad-card > a {
  display: block;
  text-decoration: none;
}

.ad-card__image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--paper-deep);
}

.ad-card__body {
  padding: 0.7rem 0.85rem 0.85rem;
}

.ad-card__tag {
  display: inline-block;
  margin-bottom: 0.25rem;
  color: var(--gold);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.ad-card__title {
  margin: 0;
  font-family: var(--serif);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.45;
}

.ad-card__hint {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.66rem;
}

/* --------------------------------------------------------------------------
   Buttons, fields, dialogs
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 46px;
  padding: 0.68rem 1.35rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.btn--primary {
  background: var(--maroon);
  border-color: var(--maroon);
  color: #fff;
}

.btn--primary:hover:not(:disabled) {
  background: var(--maroon-deep);
  border-color: var(--maroon-deep);
}

.btn--outline {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink-soft);
}

.btn--outline:hover {
  border-color: var(--maroon);
  color: var(--maroon);
}

.btn--ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink-soft);
}

.btn--ghost:hover {
  border-color: var(--line-strong);
  background: var(--paper);
}

.btn--danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn--danger:hover {
  background: #8a2020;
}

.btn--block {
  width: 100%;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0 0 1.1rem;
}

.field--fieldset {
  padding: 0;
  border: 0;
}

.field__label {
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.field__label em {
  color: var(--maroon);
  font-style: normal;
}

.field__optional {
  color: var(--muted);
  font-weight: 400;
}

.field__hint {
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.5;
}

.input {
  width: 100%;
  min-height: 48px;
  padding: 0.68rem 0.85rem;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fffdf9;
  font-size: 0.9rem;
  user-select: text;
  -webkit-user-select: text;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.input::placeholder {
  color: #b2a696;
}

.input:focus {
  outline: none;
  border-color: var(--maroon);
  box-shadow: 0 0 0 3px rgba(124, 31, 38, 0.1);
}

.input--textarea {
  min-height: 112px;
  resize: vertical;
  line-height: 1.7;
}

.form-error {
  margin: 0 0 0.9rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid rgba(166, 43, 43, 0.25);
  border-radius: 9px;
  background: #fbeeee;
  color: #8a2020;
  font-size: 0.78rem;
}

.dialog {
  width: min(92vw, 460px);
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 30px 90px -30px rgba(0, 0, 0, 0.5);
}

.dialog::backdrop {
  background: rgba(29, 22, 18, 0.55);
  backdrop-filter: blur(4px);
}

.dialog__form {
  padding: 1.5rem;
}

.dialog__title {
  margin: 0 0 0.6rem;
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 600;
}

.dialog__text {
  margin: 0 0 1.2rem;
  color: var(--ink-soft);
  font-size: 0.86rem;
  line-height: 1.65;
}

.dialog__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1.1rem;
}

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

.contact {
  max-width: var(--max);
  margin: 0 auto;
  padding: 2.8rem 1.1rem;
  border-top: 1px solid var(--line);
}

.contact__title {
  margin: 0 0 1.3rem;
  font-family: var(--serif);
  font-size: clamp(1.4rem, 4vw, 1.8rem);
  font-weight: 600;
}

.contact__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.4rem;
  align-items: start;
}

.contact__address {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  font-family: var(--serif);
  font-size: 0.98rem;
  font-style: normal;
  line-height: 1.8;
  color: var(--ink-soft);
}

.contact__address strong {
  margin-bottom: 0.15rem;
  color: var(--ink);
  font-size: 1.08rem;
}

.contact__address a {
  align-self: flex-start;
  margin-top: 0.45rem;
  color: var(--maroon);
  font-family: var(--sans);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
}

.contact__address a:hover {
  text-decoration: underline;
}

.contact__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

/* --------------------------------------------------------------------------
   Single post / permalink
   -------------------------------------------------------------------------- */

.permalink-main {
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 1.1rem 3.5rem;
}

.permalink__back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 1.5rem;
  color: var(--muted);
  font-size: 0.76rem;
  text-decoration: none;
}

.permalink__back:hover {
  color: var(--maroon);
}

.permalink__title {
  margin: 0 0 0.6rem;
  font-family: var(--serif);
  font-size: clamp(1.75rem, 5vw, 2.55rem);
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.015em;
}

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

.permalink__media {
  overflow: hidden;
  margin: 1.4rem 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-deep);
}

.permalink__media iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
}

.permalink__media > img {
  display: block;
  width: 100%;
  height: auto;
}

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

.permalink__gallery button {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.permalink__gallery img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 9px;
}

.permalink__description {
  margin: 1.4rem 0;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 1.02rem;
  line-height: 1.95;
  white-space: pre-line;
}

.permalink__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.8rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
}

.permalink__actions .btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
}

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

.site-footer {
  padding: 2.8rem 1.2rem 2rem;
  border-top: 1px solid var(--line);
  background: rgba(255, 253, 249, 0.55);
  text-align: center;
}

.site-footer__logo {
  width: 44px;
  height: 44px;
  margin: 0 auto 0.7rem;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(177, 138, 81, 0.5);
}

.site-footer__brand {
  margin: 0;
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.site-footer__ta {
  margin: 0.15rem 0 0.8rem;
  color: var(--muted);
  font-size: 0.73rem;
}

.site-footer__links {
  display: flex;
  justify-content: center;
  gap: 0.55rem;
  margin: 0 0 0.9rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.site-footer__links a {
  text-decoration: none;
}

.site-footer__links a:hover {
  color: var(--maroon);
}

.site-footer__copy,
.site-footer__credit {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.68rem;
}

.site-footer__credit a {
  color: var(--ink-soft);
  font-weight: 600;
  text-decoration-color: var(--line-strong);
}

.site-footer__credit a:hover {
  color: var(--maroon);
}

.postbox-footer {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  padding: 2rem 1rem 2.5rem;
  color: var(--muted);
  font-size: 0.7rem;
}

.postbox-footer a {
  color: var(--ink-soft);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Postbox — login
   -------------------------------------------------------------------------- */

.postbox-body {
  background:
    radial-gradient(800px 400px at 50% -180px, #fffdf9 0%, rgba(255, 253, 249, 0) 70%),
    var(--paper);
}

.login {
  min-height: calc(100vh - 140px);
  display: grid;
  place-items: center;
  padding: 2rem 1.1rem 3rem;
}

.login__card {
  width: 100%;
  max-width: 430px;
  padding: 2rem 1.4rem;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}

.login__logo {
  width: 84px;
  height: 84px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  object-fit: cover;
  box-shadow:
    0 0 0 1px rgba(177, 138, 81, 0.5),
    0 0 0 6px var(--paper);
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--gold);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.login__title {
  margin: 0 0 0.45rem;
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1.3;
}

.login__text {
  margin: 0 auto 1.4rem;
  max-width: 34ch;
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.65;
}

.login__form {
  text-align: left;
}

.login__back {
  display: inline-block;
  margin-top: 1.1rem;
  color: var(--muted);
  font-size: 0.75rem;
  text-decoration: none;
}

.login__back:hover {
  color: var(--maroon);
}

/* --------------------------------------------------------------------------
   Postbox — dashboard
   -------------------------------------------------------------------------- */

.dashboard {
  max-width: var(--max);
  margin: 0 auto;
  padding: 2rem 1.1rem 3rem;
}

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

.section-head__title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.7rem, 5vw, 2.3rem);
  font-weight: 600;
  line-height: 1.3;
}

.section-head__text {
  margin: 0.35rem 0 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.section-head__date {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
}

.postbox-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.1rem;
  align-items: start;
}

.card {
  min-width: 0;
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.9rem;
}

.card__head--wrap {
  flex-wrap: wrap;
}

.card__title {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.35;
}

.card__subtitle {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.7rem;
}

.card__note {
  margin: 1rem 0 0;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.55;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.35rem;
}

.publish-status {
  color: var(--muted);
  font-size: 0.72rem;
}

/* Segmented control */

.segmented {
  display: inline-flex;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
}

.segmented__button {
  min-height: 40px;
  padding: 0.45rem 1.1rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

.segmented__button.is-active {
  background: var(--surface);
  color: var(--maroon);
  box-shadow: 0 2px 10px -4px rgba(68, 34, 22, 0.35);
}

/* Upload zones */

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  width: 100%;
  min-height: 138px;
  margin-bottom: 0.8rem;
  padding: 1.25rem 1rem;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink-soft);
  text-align: center;
  transition:
    border-color 0.2s ease,
    background 0.2s ease;
}

.dropzone:hover,
.dropzone.is-dragging {
  border-color: var(--maroon);
  background: var(--maroon-soft);
}

.dropzone svg {
  width: 26px;
  height: 26px;
  stroke: var(--maroon);
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dropzone__title {
  font-size: 0.84rem;
  font-weight: 600;
}

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

.previews {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.7rem;
}

.preview {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper-deep);
}

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

.preview__remove {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(29, 22, 18, 0.7);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
}

.preview__status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(255, 253, 249, 0.78);
  color: var(--maroon);
  font-size: 0.65rem;
  font-weight: 600;
}

.video-preview {
  position: relative;
  overflow: hidden;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper-deep);
  aspect-ratio: 16 / 9;
}

.video-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-preview__play {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 253, 249, 0.92);
  color: var(--maroon);
  transform: translate(-50%, -50%);
}

.video-preview__play svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  margin-left: 2px;
}

.video-preview__text {
  position: absolute;
  left: 0.6rem;
  bottom: 0.6rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: rgba(29, 22, 18, 0.65);
  color: #fff;
  font-size: 0.62rem;
}

/* Recent posts list */

.mini-list {
  display: flex;
  flex-direction: column;
}

.mini-list__empty {
  margin: 0;
  padding: 1.5rem 0;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

.mini-item {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 0.7rem;
  align-items: center;
  padding: 0.7rem 0;
  border-top: 1px solid var(--line);
}

.mini-item:first-child {
  border-top: 0;
}

.mini-item__thumb {
  width: 54px;
  height: 54px;
  border-radius: 9px;
  object-fit: cover;
  background: var(--paper-deep);
}

.mini-item__body {
  min-width: 0;
}

.mini-item__title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  margin: 0;
  font-family: var(--serif);
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.45;
}

.mini-item__meta {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.65rem;
}

.mini-item__actions {
  display: flex;
  gap: 0.2rem;
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  transition:
    background 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease;
}

.icon-btn:hover {
  border-color: var(--line);
  background: var(--paper);
  color: var(--maroon);
}

.icon-btn--danger:hover {
  border-color: rgba(166, 43, 43, 0.25);
  background: #fbeeee;
  color: var(--danger);
}

.icon-btn svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --------------------------------------------------------------------------
   Postbox — advertisements
   -------------------------------------------------------------------------- */

.ads-card {
  margin-top: 1.1rem;
}

.ad-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}

.ad-form__image {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.ad-upload {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--muted);
  transition:
    border-color 0.2s ease,
    background 0.2s ease;
}

.ad-upload:hover {
  border-color: var(--maroon);
  background: var(--maroon-soft);
}

.ad-upload img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ad-upload__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.74rem;
  font-weight: 600;
}

.ad-upload__empty svg {
  width: 26px;
  height: 26px;
  stroke: var(--maroon);
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.text-btn {
  align-self: flex-start;
  padding: 0;
  border: 0;
  background: none;
  color: var(--maroon);
  font-size: 0.7rem;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ad-form__fields {
  min-width: 0;
}

.ad-postbox-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
  gap: 0.8rem;
  padding-top: 1rem;
}

.ad-postbox-item {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
}

.ad-postbox-item img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: var(--paper-deep);
}

.ad-postbox-item__body {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0.55rem 0.55rem 0.55rem 0.7rem;
}

.ad-postbox-item__title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  margin: 0;
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.4;
}

.ad-postbox-item__link {
  display: block;
  margin: 0.1rem 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.62rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Lightbox
   -------------------------------------------------------------------------- */

.lightbox {
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
  margin: 0;
  padding: 3rem 0.8rem;
  border: 0;
  background: rgba(22, 16, 13, 0.95);
  color: #fff;
}

.lightbox:not([open]) {
  display: none;
}

.lightbox[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox__figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  margin: 0;
  min-width: 0;
  max-width: 100%;
}

.lightbox__image {
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.7);
}

.lightbox__caption {
  max-width: 60ch;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.76rem;
  text-align: center;
}

.lightbox__close,
.lightbox__nav {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  transition: background 0.2s ease;
  z-index: 2;
}

.lightbox__close:hover,
.lightbox__nav:hover {
  background: rgba(255, 255, 255, 0.18);
}

.lightbox__close {
  position: absolute;
  right: 0.8rem;
  top: 0.8rem;
}

.lightbox__close svg,
.lightbox__nav svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox__nav--prev {
  left: 0.8rem;
}

.lightbox__nav--next {
  right: 0.8rem;
}

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.2rem;
  z-index: 80;
  max-width: min(92vw, 440px);
  padding: 0.7rem 1.1rem;
  border-radius: 999px;
  background: #2a211b;
  color: #fff;
  font-size: 0.78rem;
  text-align: center;
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.6);
  transform: translateX(-50%);
}

.toast--error {
  background: var(--danger);
}

.noscript {
  margin: 2rem auto;
  max-width: 40ch;
  text-align: center;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (min-width: 560px) {
  .brand__logo {
    width: 50px;
    height: 50px;
  }

  .brand__en {
    font-size: 1.12rem;
  }

  .brand__ta {
    font-size: 0.72rem;
  }

  .nav {
    gap: 1.3rem;
  }

  .nav__link {
    font-size: 0.84rem;
  }

  .hero {
    padding: 3.6rem 1.5rem 2.4rem;
  }

  .magazine-layout {
    padding: 0 1.5rem 4rem;
  }

  .post__body {
    padding: 1.35rem 1.5rem 1.5rem;
  }

  .post__title {
    font-size: 1.5rem;
  }

  .post--featured .post__title {
    font-size: 1.8rem;
  }

  .previews {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .card {
    padding: 1.5rem;
  }

  .ad-form {
    grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
    gap: 1.2rem;
  }

  .ad-rail__list {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  }

  .contact {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  .contact__grid {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .permalink-main {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  .permalink__gallery {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 860px) {
  .hero {
    padding: 4.4rem 1.5rem 2.8rem;
  }

  .day-group {
    padding-left: 2rem;
  }

  .post--featured {
    display: grid;
    grid-template-columns: minmax(0, 1.16fr) minmax(0, 0.84fr);
  }

  .post--featured .post__media {
    height: 100%;
    min-height: 300px;
    aspect-ratio: auto;
  }

  .post--featured .post__body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 1.8rem;
  }

  .postbox-grid {
    grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
    gap: 1.4rem;
  }

  .section-head {
    margin-bottom: 1.8rem;
  }

  .section-head__text {
    font-size: 0.86rem;
  }
}

@media (min-width: 1000px) {
  .masthead__inner {
    padding: 0.85rem 1.5rem;
  }

  .magazine-layout {
    gap: 2.6rem;
    padding: 0 1.5rem 5rem;
  }

  .magazine-layout.has-ads {
    grid-template-columns: minmax(0, 1fr) 300px;
  }

  .magazine-layout:not(.has-ads) {
    grid-template-columns: minmax(0, 820px);
    justify-content: center;
  }

  .ad-rail {
    position: sticky;
    top: 6.4rem;
    order: 0;
  }

  .ad-rail__list {
    grid-template-columns: minmax(0, 1fr);
  }

  .timeline::before {
    left: 5px;
  }

  .post__media {
    aspect-ratio: 16 / 9;
  }

  .post--photo .post__media {
    aspect-ratio: 4 / 3;
  }
}

@media (max-width: 520px) {
  .nav__link[href="#feed"] {
    display: none;
  }
}

@media (max-width: 400px) {
  .brand__ta {
    display: none;
  }

  .nav {
    gap: 0.7rem;
  }

  .nav__button {
    padding-left: 0.7rem;
  }

  .post__title {
    font-size: 1.22rem;
  }

  .post--featured .post__title {
    font-size: 1.3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .js .post {
    opacity: 1;
    transform: none;
  }
}
