/*
 * Paphos Community design system (plan 2.0). Owned by T1.2.
 * Tokens, base styles, layout (header, tabs, language switch, account menu,
 * footer) and the shared components in src/views/components.tsx.
 * Feature styles go in css/pages/<feature>.css. Light only (G5): a dark
 * theme is one @media (prefers-color-scheme: dark) block over :root.
 */

/* ---------- Fonts: self-hosted Nunito (OFL), variable weight ---------- */

@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url("/fonts/nunito-latin-ext-var.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url("/fonts/nunito-latin-var.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Tokens ---------- */

:root {
  --pc-font: "Nunito", system-ui, sans-serif;
  --pc-bg: #fff8f0;
  --pc-surface: #ffffff;
  --pc-border: #ffe0cc;
  --pc-text: #2d2b3d;
  --pc-text-2: #6b6880;
  --pc-muted: #736f8b;
  --pc-primary: #d14545;
  --pc-primary-soft: #ff6b6b;
  --pc-accent: #ffd93d;
  --pc-wa: #0f7a40;
  --pc-wa-tint: #e3f9ec;
  --pc-link: #1f7a70;
  --pc-link-tint: #e0f2ef;
  --pc-chip-bg: #fff1e6;
  --pc-radius-sm: 12px;
  --pc-radius-md: 16px;
  --pc-radius-lg: 20px;
  --pc-radius-pill: 999px;
  --pc-target: 44px;
  --pc-shadow: 0 1px 3px rgba(45, 43, 61, 0.06);
  --pc-shadow-raised: 0 1px 2px rgba(45, 43, 61, 0.1);
  --pc-shadow-menu: 0 8px 24px rgba(45, 43, 61, 0.14);

  /* Status colours: old palette, darkened to ≥ 4.5:1 on --pc-surface. */
  --pc-danger: #b91c1c;
  --pc-danger-tint: #fef2f2;
  --pc-warning: #b45309;
  --pc-warning-tint: #fffbeb;
  --pc-success: #047857;
  --pc-success-tint: #ecfdf5;

  --pc-max-width: 1200px;
  --pc-gutter: 32px;
  --pc-focus: 0 0 0 3px var(--pc-surface), 0 0 0 5px var(--pc-primary);
}

@media (max-width: 719px) {
  :root {
    --pc-gutter: 16px;
  }
}

/* ---------- Base ---------- */

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--pc-bg);
  color: var(--pc-text);
  font-family: var(--pc-font);
  font-weight: 500;
  font-size: 16px;
  line-height: 1.45;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-weight: 900;
  font-size: 44px;
  line-height: 1.1;
  overflow-wrap: break-word;
  hyphens: auto;
}

h2 {
  font-weight: 800;
  font-size: 20px;
  line-height: 1.25;
}

@media (max-width: 719px) {
  h1 {
    font-size: 28px;
    line-height: 1.15;
  }
}

a {
  color: var(--pc-primary);
}

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

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

:focus-visible {
  outline: none;
  box-shadow: var(--pc-focus);
  border-radius: var(--pc-radius-sm);
}

.icon {
  flex: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -100px;
  z-index: 100;
  min-height: var(--pc-target);
  padding: 0 16px;
  display: flex;
  align-items: center;
  border-radius: var(--pc-radius-sm);
  background: var(--pc-surface);
  font-weight: 800;
}

.skip-link:focus {
  top: 8px;
}

/* Generic page container: pages use it for their own sections. */
.container {
  width: 100%;
  max-width: var(--pc-max-width);
  margin: 0 auto;
  padding: 0 var(--pc-gutter);
}

/* Card grid: auto-fill 320 px columns, one column on phone. */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

@media (max-width: 719px) {
  .grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

/* Small text link with a ≥44 px target ("See all events", "All events"). */
.text-link {
  min-height: var(--pc-target);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--pc-primary);
  font-weight: 800;
  font-size: 15px;
  text-decoration: none;
}

.text-link:hover {
  text-decoration: underline;
}

/* ---------- Header ---------- */

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

.site-header__inner {
  max-width: var(--pc-max-width);
  margin: 0 auto;
  padding: 12px var(--pc-gutter);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--pc-target);
  color: var(--pc-text);
  text-decoration: none;
}

.brand__tile {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: var(--pc-radius-sm);
  background: var(--pc-primary-soft);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand__name {
  font-weight: 900;
  font-size: 20px;
  line-height: 1.1;
}

/* Section tabs: underline bar on desktop, segmented control on phone. */
.tabs {
  display: flex;
  gap: 4px;
}

.tabs__tab {
  height: var(--pc-target);
  display: flex;
  align-items: center;
  font-weight: 700;
  font-size: 16px;
  color: var(--pc-text-2);
  text-decoration: none;
}

.tabs__tab[aria-current="page"] {
  font-weight: 800;
  color: var(--pc-text);
}

.tabs--bar {
  flex: 1 1 auto;
}

.tabs--bar .tabs__tab {
  padding: 0 14px;
  border-bottom: 3px solid transparent;
}

.tabs--bar .tabs__tab[aria-current="page"] {
  border-bottom-color: var(--pc-primary-soft);
}

.tabs--bar .tabs__tab:hover {
  color: var(--pc-text);
}

.tabs--segmented {
  display: none;
  margin: 16px var(--pc-gutter) 0;
  padding: 4px;
  background: var(--pc-chip-bg);
  border-radius: 14px;
}

.tabs--segmented .tabs__tab {
  flex: 1;
  justify-content: center;
  border-radius: 10px;
}

.tabs--segmented .tabs__tab[aria-current="page"] {
  background: var(--pc-surface);
  box-shadow: var(--pc-shadow-raised);
}

/* Language switch (desktop): 44 px links; the visible pill is 38 px. */
.lang-switch {
  display: flex;
  gap: 2px;
  height: var(--pc-target);
  background: var(--pc-chip-bg);
  border-radius: var(--pc-radius-pill);
}

.lang-switch__option {
  position: relative;
  min-width: var(--pc-target);
  height: var(--pc-target);
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--pc-text-2);
  text-decoration: none;
  border-radius: var(--pc-radius-pill);
  z-index: 0;
}

.lang-switch__option::before {
  content: "";
  position: absolute;
  inset: 3px;
  z-index: -1;
  border-radius: var(--pc-radius-pill);
}

.lang-switch__option[aria-current="true"] {
  font-weight: 800;
  color: var(--pc-text);
}

.lang-switch__option[aria-current="true"]::before {
  background: var(--pc-surface);
  box-shadow: var(--pc-shadow-raised);
}

.lang-switch__option:hover {
  color: var(--pc-text);
}

/* <details> menus (language on phone, account). */
.menu {
  position: relative;
}

.menu > summary {
  list-style: none;
  cursor: pointer;
}

.menu > summary::-webkit-details-marker {
  display: none;
}

.menu__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 20;
  min-width: 200px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--pc-surface);
  border: 1px solid var(--pc-border);
  border-radius: var(--pc-radius-md);
  box-shadow: var(--pc-shadow-menu);
  display: flex;
  flex-direction: column;
}

.menu__item {
  width: 100%;
  min-height: var(--pc-target);
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--pc-text);
  font-weight: 700;
  font-size: 15px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.menu__item:hover,
.menu__item[aria-current="true"] {
  background: var(--pc-chip-bg);
}

.menu__code {
  min-width: 24px;
  font-weight: 800;
}

.lang-menu {
  display: none;
}

.lang-menu__button {
  height: var(--pc-target);
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--pc-border);
  border-radius: var(--pc-radius-pill);
  background: var(--pc-surface);
  font-weight: 800;
  font-size: 14px;
}

.account-menu__button {
  height: var(--pc-target);
  padding: 0 12px 0 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--pc-border);
  border-radius: var(--pc-radius-pill);
  background: var(--pc-surface);
  font-weight: 700;
  font-size: 15px;
}

.header-signin.btn {
  height: var(--pc-target);
  padding: 0 20px;
  border-radius: var(--pc-radius-pill);
}

@media (max-width: 719px) {
  .site-header__inner {
    flex-wrap: nowrap;
    gap: 8px;
  }

  .brand {
    flex: 1;
    min-width: 0;
  }

  .brand__tile {
    width: 36px;
    height: 36px;
  }

  .brand__tile .icon {
    width: 20px;
    height: 20px;
  }

  .brand__name {
    font-size: 17px;
  }

  .brand__name > span {
    display: block;
  }

  .tabs--bar,
  .lang-switch {
    display: none;
  }

  .tabs--segmented,
  .lang-menu {
    display: flex;
  }

  .lang-menu {
    flex: none;
  }

  .header-signin.btn {
    flex: none;
    padding: 0 16px;
  }

  .account-menu {
    flex: none;
  }

  .account-menu__button {
    width: var(--pc-target);
    padding: 0;
    border: 0;
    justify-content: center;
    background: transparent;
  }

  .account-menu__button .avatar {
    width: var(--pc-target);
    height: var(--pc-target);
    font-size: 15px;
  }

  .account-menu__name,
  .account-menu__chevron {
    display: none;
  }
}

/* ---------- Main + footer ---------- */

.site-main {
  flex: 1;
  width: 100%;
  max-width: var(--pc-max-width);
  margin: 0 auto;
  padding: 24px var(--pc-gutter) 64px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

@media (max-width: 719px) {
  .site-main {
    padding: 18px var(--pc-gutter) 32px;
    gap: 18px;
  }
}

.site-footer {
  border-top: 1px solid var(--pc-border);
  background: var(--pc-surface);
}

.site-footer__inner {
  max-width: var(--pc-max-width);
  margin: 0 auto;
  padding: 20px var(--pc-gutter);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 14px;
  color: var(--pc-muted);
}

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 20px;
}

.site-footer__links a {
  min-height: var(--pc-target);
  display: inline-flex;
  align-items: center;
  color: var(--pc-text-2);
}

/* ---------- Components ---------- */

/* Button: primary | outline | whatsapp | link. */
.btn {
  min-height: var(--pc-target);
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1.5px solid transparent;
  border-radius: var(--pc-radius-sm);
  font-weight: 800;
  font-size: 15px;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--pc-primary);
  color: #ffffff;
}

.btn--primary:hover {
  background: #b93a3a;
}

.btn--outline {
  background: var(--pc-surface);
  border-color: var(--pc-primary-soft);
  color: var(--pc-primary);
}

.btn--outline:hover {
  background: var(--pc-chip-bg);
}

.btn--whatsapp {
  background: var(--pc-wa);
  color: #ffffff;
}

.btn--whatsapp:hover {
  background: #0b6434;
}

.btn--link {
  background: var(--pc-link);
  color: #ffffff;
}

.btn--link:hover {
  background: #18635b;
}

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

.btn--lg {
  min-height: 52px;
  font-size: 16px;
}

/* Chip: a pill link; aria-current="true" = active. */
.chip {
  min-height: var(--pc-target);
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  border: 1px solid var(--pc-border);
  border-radius: var(--pc-radius-pill);
  background: var(--pc-surface);
  color: var(--pc-text);
  font-weight: 800;
  font-size: 15px;
  text-decoration: none;
}

.chip[aria-current="true"] {
  background: var(--pc-primary);
  border-color: var(--pc-primary);
  color: #ffffff;
}

/* SearchField. */
.search-field {
  width: 100%;
  max-width: 600px;
  height: 56px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--pc-surface);
  border: 1px solid var(--pc-border);
  border-radius: var(--pc-radius-md);
  color: var(--pc-muted);
}

.search-field:focus-within {
  box-shadow: var(--pc-focus);
}

.search-field input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: none;
  background: transparent;
  font-weight: 500;
  font-size: 17px;
  color: var(--pc-text);
}

.search-field input::placeholder {
  color: var(--pc-muted);
  opacity: 1;
}

.search-field input:focus-visible {
  box-shadow: none;
}

@media (max-width: 719px) {
  .search-field {
    height: 52px;
    padding: 0 16px;
  }

  .search-field input {
    font-size: 16px;
  }
}

/* Card. */
.card {
  background: var(--pc-surface);
  border-radius: var(--pc-radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--pc-shadow);
}

@media (max-width: 719px) {
  .card {
    padding: 16px;
  }
}

/* ShowMore: the last child of a card grid, across every column. */
.show-more {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
}

.show-more .btn.htmx-request {
  opacity: 0.55;
  cursor: progress;
}

/* DateTile. */
.date-tile {
  width: 56px;
  height: 60px;
  flex: none;
  border-radius: var(--pc-radius-sm);
  background: var(--pc-accent);
  color: var(--pc-text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.date-tile__month {
  font-weight: 800;
  font-size: 12px;
}

.date-tile__day {
  font-weight: 900;
  font-size: 24px;
}

.date-tile--lg {
  width: 120px;
  height: 132px;
  border-radius: var(--pc-radius-lg);
}

.date-tile--lg .date-tile__month {
  font-size: 22px;
}

.date-tile--lg .date-tile__day {
  font-size: 60px;
}

/* Avatar: initials on --pc-accent. sm = 36 px, md = 40 px. */
.avatar {
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: var(--pc-radius-pill);
  background: var(--pc-accent);
  color: var(--pc-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 14px;
  line-height: 1;
}

.avatar--md {
  width: 40px;
  height: 40px;
}

/* Field. */
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field__label {
  font-weight: 800;
  font-size: 15px;
}

.field__hint {
  font-size: 14px;
  color: var(--pc-text-2);
}

.field__control {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border: 1.5px solid var(--pc-border);
  border-radius: var(--pc-radius-sm);
  background: var(--pc-surface);
  font-weight: 500;
  font-size: 17px;
  color: var(--pc-text);
}

textarea.field__control {
  min-height: 96px;
  padding: 12px 14px;
  resize: vertical;
  font-size: 16px;
}

select.field__control {
  appearance: auto;
}

.field__control::placeholder {
  color: var(--pc-muted);
  opacity: 1;
}

.field__control:focus-visible {
  border-color: var(--pc-primary);
  box-shadow: none;
  outline: 2px solid var(--pc-primary);
  outline-offset: 0;
}

.field--error .field__control {
  border-color: var(--pc-danger);
}

.field__error {
  font-weight: 700;
  font-size: 14px;
  color: var(--pc-danger);
}

/* Checkbox row (e.g. the sign-in consent). */
.check {
  min-height: var(--pc-target);
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 15px;
}

.check input {
  width: 22px;
  height: 22px;
  margin: 0;
  flex: none;
  accent-color: var(--pc-primary);
}

/* ErrorBox. */
.error-box {
  padding: 14px 16px;
  border: 1px solid var(--pc-danger);
  border-radius: var(--pc-radius-md);
  background: var(--pc-danger-tint);
  color: var(--pc-danger);
  font-weight: 700;
  font-size: 15px;
}

/* Badge. */
.badge {
  min-height: 26px;
  padding: 2px 10px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--pc-radius-pill);
  font-weight: 800;
  font-size: 13px;
  white-space: nowrap;
}

.badge--neutral {
  background: var(--pc-chip-bg);
  color: var(--pc-text-2);
}

.badge--danger {
  background: var(--pc-danger-tint);
  color: var(--pc-danger);
}

.badge--warning {
  background: var(--pc-warning-tint);
  color: var(--pc-warning);
}

.badge--success {
  background: var(--pc-success-tint);
  color: var(--pc-success);
}

/* EmptyState. */
.empty-state {
  padding: 40px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  background: var(--pc-surface);
  border: 1px dashed var(--pc-border);
  border-radius: var(--pc-radius-lg);
}

.empty-state__title {
  font-weight: 800;
  font-size: 20px;
}

.empty-state__text {
  max-width: 520px;
  color: var(--pc-text-2);
}

.empty-state__actions {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

/* Flash. */
.flash {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--pc-success);
  border-radius: var(--pc-radius-md);
  background: var(--pc-success-tint);
  color: var(--pc-success);
  font-weight: 700;
  font-size: 15px;
}

/* 404 / 500 pages. */
.status-page {
  align-self: center;
  max-width: 520px;
  margin: 32px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.status-page__code {
  font-weight: 900;
  font-size: 64px;
  line-height: 1;
  color: var(--pc-primary-soft);
}

.status-page__text {
  margin-bottom: 8px;
  font-size: 17px;
  color: var(--pc-text-2);
}

/* htmx request indicator (htmx's own inline styles are off: CSP). */
.htmx-indicator {
  opacity: 0;
  transition: opacity 200ms ease-in;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  opacity: 1;
}

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