/*
Theme Name: Applemag iOS 27
Theme URI: https://applemag.net/
Author: Codex
Author URI: https://openai.com/
Description: A polished iOS-inspired editorial WordPress theme for Applemag.net.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.6
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: applemag-ios27
Tags: blog, news, custom-logo, featured-images, one-column, two-columns, threaded-comments, translation-ready
*/

:root {
  --am-bg: #f6f7fb;
  --am-surface: rgba(255, 255, 255, 0.76);
  --am-surface-strong: rgba(255, 255, 255, 0.92);
  --am-text: #101217;
  --am-muted: #606775;
  --am-border: rgba(17, 24, 39, 0.11);
  --am-hairline: rgba(17, 24, 39, 0.08);
  --am-blue: #0a84ff;
  --am-green: #30d158;
  --am-pink: #ff375f;
  --am-violet: #7d5cff;
  --am-shadow: 0 22px 70px rgba(20, 32, 55, 0.14);
  --am-radius: 22px;
  --am-radius-small: 14px;
  --am-width: 1160px;
  --am-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --am-bg: #080a0f;
    --am-surface: rgba(25, 28, 36, 0.68);
    --am-surface-strong: rgba(27, 31, 40, 0.9);
    --am-text: #f5f7fb;
    --am-muted: #a6adbb;
    --am-border: rgba(255, 255, 255, 0.14);
    --am-hairline: rgba(255, 255, 255, 0.09);
    --am-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  color: var(--am-text);
  background:
    radial-gradient(circle at 12% 8%, rgba(10, 132, 255, 0.18), transparent 28rem),
    radial-gradient(circle at 88% 14%, rgba(255, 55, 95, 0.16), transparent 26rem),
    linear-gradient(180deg, #fbfcff 0%, var(--am-bg) 36%, var(--am-bg) 100%);
  font-family: var(--am-font);
  font-size: 17px;
  line-height: 1.58;
}

@media (prefers-color-scheme: dark) {
  body {
    background:
      radial-gradient(circle at 12% 8%, rgba(10, 132, 255, 0.22), transparent 27rem),
      radial-gradient(circle at 86% 14%, rgba(255, 55, 95, 0.15), transparent 25rem),
      linear-gradient(180deg, #10131b 0%, var(--am-bg) 40%, var(--am-bg) 100%);
  }
}

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

a:hover,
a:focus {
  color: var(--am-blue);
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

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

.am-shell {
  width: min(calc(100% - 32px), var(--am-width));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 12px;
  z-index: 50;
  margin: 12px 0 28px;
}

.am-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 64px;
  padding: 10px 12px 10px 18px;
  background: var(--am-surface);
  border: 1px solid var(--am-border);
  border-radius: 999px;
  box-shadow: 0 12px 46px rgba(25, 35, 60, 0.12);
  backdrop-filter: blur(28px) saturate(165%);
  -webkit-backdrop-filter: blur(28px) saturate(165%);
}

.site-branding {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  font-weight: 750;
  letter-spacing: 0;
}

.site-logo-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: white;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.26), transparent 38%),
    linear-gradient(135deg, var(--am-blue), var(--am-violet) 48%, var(--am-pink));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 10px 24px rgba(10, 132, 255, 0.28);
}

.site-logo-mark svg {
  width: 23px;
  height: 23px;
}

.site-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.05;
}

.site-description {
  margin: 2px 0 0;
  color: var(--am-muted);
  font-size: 12px;
  font-weight: 560;
  line-height: 1.2;
}

.primary-menu {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.primary-menu a {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 14px;
  color: var(--am-muted);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 660;
}

.primary-menu .current-menu-item > a,
.primary-menu a:hover,
.primary-menu a:focus {
  color: var(--am-text);
  background: rgba(128, 128, 128, 0.12);
}

.am-search-link {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: rgba(128, 128, 128, 0.13);
}

.am-search-link svg,
.am-icon {
  width: 18px;
  height: 18px;
}

.am-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(280px, 0.72fr);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 34px;
}

.hero-card,
.am-panel,
.post-card,
.widget,
.comment-body {
  background: var(--am-surface);
  border: 1px solid var(--am-border);
  border-radius: var(--am-radius);
  box-shadow: var(--am-shadow);
  backdrop-filter: blur(26px) saturate(150%);
  -webkit-backdrop-filter: blur(26px) saturate(150%);
}

.hero-card {
  position: relative;
  min-height: 510px;
  overflow: hidden;
}

.hero-card img {
  width: 100%;
  height: 100%;
  min-height: 510px;
  object-fit: cover;
}

.hero-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 18%, rgba(0, 0, 0, 0.18) 48%, rgba(0, 0, 0, 0.78));
}

.hero-content {
  position: absolute;
  inset: auto 0 0;
  z-index: 1;
  padding: clamp(22px, 4vw, 42px);
  color: white;
}

.am-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  color: inherit;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.am-kicker::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--am-green);
  box-shadow: 0 0 0 7px rgba(48, 209, 88, 0.22);
}

.hero-title {
  max-width: 760px;
  margin: 0;
  font-size: clamp(36px, 5.2vw, 72px);
  line-height: 0.96;
  letter-spacing: 0;
}

.hero-excerpt {
  max-width: 690px;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: clamp(17px, 1.9vw, 21px);
}

.hero-side {
  display: grid;
  gap: 18px;
}

.am-panel {
  padding: 24px;
}

.panel-title,
.section-title,
.widget-title {
  margin: 0 0 16px;
  font-size: 14px;
  font-weight: 820;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.trend-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.trend-list a {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--am-hairline);
  border-radius: 16px;
  background: rgba(128, 128, 128, 0.07);
}

.trend-number {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: white;
  border-radius: 13px;
  background: #111827;
  font-weight: 820;
}

.trend-title {
  display: -webkit-box;
  overflow: hidden;
  color: var(--am-text);
  font-size: 15px;
  font-weight: 760;
  line-height: 1.28;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.am-quick-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.am-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--am-hairline);
  border-radius: 999px;
  background: rgba(128, 128, 128, 0.08);
  color: var(--am-muted);
  font-size: 14px;
  font-weight: 720;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: start;
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.post-card {
  overflow: hidden;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.post-card:hover {
  transform: translateY(-3px);
  border-color: rgba(10, 132, 255, 0.32);
}

.post-card .post-thumbnail {
  aspect-ratio: 16 / 10;
  background: rgba(128, 128, 128, 0.12);
  overflow: hidden;
}

.post-card .post-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-card-content {
  padding: 20px;
}

.entry-meta,
.entry-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  color: var(--am-muted);
  font-size: 13px;
  font-weight: 650;
}

.entry-title {
  margin: 9px 0 10px;
  font-size: clamp(22px, 2.2vw, 30px);
  line-height: 1.08;
  letter-spacing: 0;
}

.post-card .entry-title {
  font-size: 23px;
}

.entry-summary,
.entry-content {
  color: var(--am-muted);
}

.entry-summary p,
.entry-content p {
  margin: 0 0 1.1em;
}

.entry-content {
  font-size: 18px;
}

.entry-content a {
  color: var(--am-blue);
  font-weight: 650;
}

.entry-content h2,
.entry-content h3 {
  color: var(--am-text);
  line-height: 1.12;
  letter-spacing: 0;
}

.entry-content blockquote {
  margin: 28px 0;
  padding: 20px 24px;
  color: var(--am-text);
  border-left: 4px solid var(--am-blue);
  border-radius: 0 var(--am-radius-small) var(--am-radius-small) 0;
  background: rgba(10, 132, 255, 0.1);
}

.single-article,
.page-article {
  max-width: 860px;
  margin: 0 auto;
}

.article-hero {
  margin-bottom: 26px;
  padding: clamp(24px, 5vw, 54px);
  background: var(--am-surface);
  border: 1px solid var(--am-border);
  border-radius: calc(var(--am-radius) + 8px);
  box-shadow: var(--am-shadow);
  backdrop-filter: blur(26px) saturate(150%);
  -webkit-backdrop-filter: blur(26px) saturate(150%);
}

.article-hero .entry-title {
  margin-top: 12px;
  font-size: clamp(38px, 5vw, 64px);
}

.article-image {
  overflow: hidden;
  margin: 0 0 28px;
  border-radius: calc(var(--am-radius) + 6px);
  box-shadow: var(--am-shadow);
}

.article-body {
  padding: clamp(22px, 4vw, 44px);
  background: var(--am-surface-strong);
  border: 1px solid var(--am-border);
  border-radius: calc(var(--am-radius) + 6px);
}

.sidebar {
  display: grid;
  gap: 18px;
}

.widget {
  padding: 22px;
}

.widget ul {
  margin: 0;
  padding-left: 1.1em;
}

.widget li + li {
  margin-top: 8px;
}

.search-form {
  display: flex;
  gap: 8px;
}

.search-field,
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
  width: 100%;
  min-height: 46px;
  padding: 11px 14px;
  color: var(--am-text);
  background: rgba(128, 128, 128, 0.1);
  border: 1px solid var(--am-border);
  border-radius: 14px;
  font: inherit;
}

.search-submit,
.submit,
.wp-block-search__button,
.nav-links a,
.page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 17px;
  color: white;
  background: var(--am-blue);
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 14px;
  font-weight: 760;
  cursor: pointer;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.page-numbers.current {
  color: var(--am-text);
  background: rgba(128, 128, 128, 0.13);
}

.site-footer {
  margin-top: 56px;
  padding: 32px 0 96px;
  color: var(--am-muted);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-top: 22px;
  border-top: 1px solid var(--am-border);
}

.comments-area {
  margin-top: 28px;
}

.comment-list {
  display: grid;
  gap: 16px;
  padding: 0;
  list-style: none;
}

.comment-body {
  padding: 20px;
}

.mobile-tabbar {
  display: none;
}

@media (max-width: 920px) {
  .am-hero,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .hero-card,
  .hero-card img {
    min-height: 430px;
  }

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

@media (max-width: 720px) {
  body {
    font-size: 16px;
  }

  .am-shell {
    width: min(calc(100% - 22px), var(--am-width));
  }

  .site-header {
    top: 8px;
    margin-bottom: 18px;
  }

  .am-nav {
    min-height: 58px;
    padding: 8px 10px 8px 12px;
  }

  .site-description,
  .menu-primary-container,
  .primary-menu {
    display: none;
  }

  .site-title {
    max-width: 54vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .hero-card,
  .hero-card img {
    min-height: 380px;
  }

  .hero-title {
    font-size: 38px;
  }

  .posts-grid,
  .sidebar {
    grid-template-columns: 1fr;
  }

  .post-card-content,
  .am-panel,
  .widget,
  .article-body {
    padding: 18px;
  }

  .article-hero .entry-title {
    font-size: 38px;
  }

  .footer-inner {
    display: grid;
  }

  .mobile-tabbar {
    position: fixed;
    right: 14px;
    bottom: 10px;
    left: 14px;
    z-index: 60;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    min-height: 48px;
    padding: 5px;
    background: var(--am-surface);
    border: 1px solid var(--am-border);
    border-radius: 18px;
    box-shadow: 0 18px 56px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(28px) saturate(165%);
    -webkit-backdrop-filter: blur(28px) saturate(165%);
  }

  .mobile-tabbar a {
    display: grid;
    place-items: center;
    color: var(--am-muted);
    min-height: 36px;
    border-radius: 13px;
  }

  .mobile-tabbar svg {
    width: 17px;
    height: 17px;
  }

  .mobile-tabbar a:hover,
  .mobile-tabbar a:focus {
    color: var(--am-text);
    background: rgba(128, 128, 128, 0.13);
  }
}
